如果让`git pull`成功,我需要做些什么?

时间:2014-02-05 02:34:07

标签: git updating

git diff给出git diff --summary的不同结果,而git pull给出了差异的不同结果。下面的每个命令都告诉我一些不同的东西被修改。

git.diff

$ git diff  | grep -i '\-\-\- a/'
--- a/apps/Makefile
--- a/apps/s_client.c
--- a/apps/s_server.c
--- a/config
--- a/crypto/Makefile
--- a/crypto/aes/Makefile
--- a/crypto/asn1/Makefile
--- a/crypto/bf/Makefile
--- a/crypto/bio/Makefile
<61 total>
...

git diff --summary

openssl-git$ git diff --summary
delete mode 100644 test/fips_algvs.c
delete mode 100644 test/igetest.c

git pull

openssl-git$ git pull
Updating ba16824..24e20db
error: Your local changes to the following files would be overwritten by merge:
        apps/s_server.c
Please, commit your changes or stash them before you can merge.
Aborting

我跟着https://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-mode-changes-chmod清除了大部分差异,但在更新回购时仍然存在一些问题。

更新此存储库我需要做什么?

2 个答案:

答案 0 :(得分:1)

要让git pull工作,看起来app / s_server.c文件在本地更改或未跟踪,但未提交,并且提交了相同的文件。您可以暂时移动该文件或提交它以使拉动成功,然后协调差异

答案 1 :(得分:0)

查看已修改跟踪文件的列表,而不是

git diff  | grep -i '\-\-\- a/'

您可以使用git diff --stat

git diff --summary仅显示文件权限的重命名,创建和更改。

从远程存储库中提取更改时,您的工作副本必须是干净的。在您展示的示例中,git表示您的本地文件apps/s_server.c已被修改,而pull也希望对其进行修改。我可以告诉你一个关于在你调用git-pull时暂时保存本地更改的不同方法的日志(特别是使用git-stash),但你好像是git的初学者,我不想混淆你更多关于新git命令的日志。您提交更改后,git-pull会合并本地和远程更改,或者在致电apps/s_server.c之前确保git pull未在本地修改。

相关问题