0

我在本地 git 文件夹中工作并使用 bitbucket 提交。不小心删除了本地副本。但我有最新的本地副本,没有 .git 文件夹。所以现在不能提交。我知道的解决方案是从 bitbucket 中删除本地副本并再次克隆。但我想要一个更好的解决方案。使用 git 命令解决此问题的最佳解决方案是什么。谢谢。

4

2 回答 2

2

我曾尝试将代码从 clearcase 迁移到 git。我认为我的解决方案将符合您的问题。只需保留您的本地副本并克隆一个您想要推送到的新副本。

然后解决方案就在这里:将 .git 文件夹复制到本地复制文件夹。尝试 git status 你会发现它有效,然后提交你想要的。

祝你好运!

于 2013-09-26T07:25:29.160 回答
0

也许这会满足你的问题。

首先输入您的本地复制目录,然后执行以下操作:

> git init
> git config remote.origin.fetch  +refs/heads/*:refs/remotes/origin/*
> git config remote.origin.url <YourUrl>
> git config branch.<branchname>.remote origin
> git config branch.<branchname>.merge refs/heads/<branchname>
> git pull
> git add .;git commit -am "****"  #Here commit your change, may you'll meet conflict issue.
> git push
于 2013-09-30T03:32:24.883 回答