Git pull results in “needs update” and files shown as modified

与世无争的帅哥 提交于 2019-11-30 21:30:11
VonC

As illustrated in this Git project, this can happen when Git tries to adjust eol style for projects developed on Unix, and cloned on Windows:

via msysgit Troubleshooting

run command in git bash: git config --global core.autocrlf false if this is not done then git svn rebase reports "needs update" thinking that changes have been made to the source May run into troubles with the commit

See this SO answer for more.

doublejosh

How I got out of the mess:

As I kept pulling to test my solutions I had to make use of...

git reset --hard which moves you back to the most recent commit in the log.

git clean -fd which kills off the untracked files since the more recent commit in the log.

Eventually I decided I needed to change the offending settings file to chmod 777 and commit the permission change. Another option would have been to change Git into permission agnostic mode with git config core.filemode false Read more here: How do I make Git ignore file mode (chmod) changes?

Then I did a pull to merge the changes and have the log update along with the files, changed the permission of the offending file back to 644 and commit that... and pushed it back to the working master (glad that's allowed.)

Seems like this is a bug that having a permission failure allows the file changesets to be merged but the log history doesn't reflect the commits!!!

BTW: My git --version is git version 1.5.6.5

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!