2012-08-26 29 views
0

我有一个被打断的git pull,现在我不确定它是否与我的.git目录混淆。我可以通过运行git fsck --full来保证我的git repo的完整性吗?是否有任何其他命令来查看是否有一半没有添加到目录中?中断的git拉

回答

0

将项目的物理副本(包括其.git目录)复制到另一个地方,例如〜/ tmp,然后运行git pull并查看它告诉你的内容。你只是在拉,这是一个丢弃目录,所以你将不会改变任何东西(只要你不确定就不会推)。

所以,如果你的应用程序目录是:〜/博客

cd ~     # "~" means your home directory 
mkdir tmp   # Make a temporary directory. 
cp -r blogger ~/tmp # Copy the project there 
cd /tmp/blogger  # Go there 
git pull    # Try a pull to see what happens. 

如果拉好的工作,你必须在你实际的目录内容的信心(所以cd回到现在) 。 如果问题出现,请保存当前的项目代码并尝试新的拉动,看看是否正常。

例如

cd ~ 
mv blogger old_blogger 
# Go to github and click on the copy icon. 
git clone [paste - ctrl-v or shift-ctrl-v] 
# Now use your old_blogger directory as a source 
# for any changes you want to (manually) copy the code from. 

如果一个新鲜git pull有问题,可以考虑将你的项目目录,并删除整个.git结构,然后git init创建一个新的Git仓库,然后删除(或重命名为old_blogger)现有GitHub的一个,创建它重新和然后git clone然后git add .,git commitgit push。这显然是最极端的('核')选择。