How to avoid getting git errors/conflicts on untou

2019-07-22 01:34发布

I often see the below errors on doing git pull on totally untouched files which I am NOT working on.

Pull is not possible because you have unmerged files

It is clear the conflicted files have changed in the git repo. But I don't understand why git pull cannot over-write on these untouched files - which I've not touched?

What can I or my team do to avoid getting these errors?

Edited - Along with the solution I want to understand why the errors are coming.

Just to make clear, the other team members are working on other files (say xyz). And I am working on a separate set of files having no dependency on xyz files. So if I pull the repo changes after a long time with no changes from my side in xyz, why the conflicts in those files?

2条回答
再贱就再见
2楼-- · 2019-07-22 01:58

use git diff to see problem files

look at this git cheat shets for usefull commands

http://www.cheat-sheets.org/saved-copy/git-cheat-sheet.pdf

http://jan-krueger.net/wordpress/wp-content/uploads/2007/09/git-cheat-sheet-v2-back.svg

There are some tips from my own experience. i'm not sure whether they're 100% corerect)

  1. Split work with your team on paralel threads. Try not to work in the same files.

  2. Try to avoid situations when 2 or more persons are adding new files simalteniously. When one added new files others should make pull as soon as possible

  3. the last but no the list - make git push very often. this will keep your project git uptodate

查看更多
走好不送
3楼-- · 2019-07-22 01:59

Since git pull does not pull individual files, it's git merge phase will stop for manual correction of any merge conflicts. git merge and/or git pull (and by nature of the fact that git pull is essentially git fetch followed by git merge) is an all-or-nothing operation - you either successfully merge the changes introduced on both (or all) of the branches you are merging together, or you don't merge any of them. The catch in that is when conflicts arise that must be manually resolved - but in that situation, you are in an in-between state, having neither completed and committed the merge nor rolled it back to your previous state.

The message you are getting implies that you have previously done a git pull or a git merge, which stopped in the middle, requesting that you manually resolve some conflicts, which you have not yet done, but have rather continued on doing other stuff, and are now trying to do another git pull / git merge without ever having completed the first one. Take a look at git status, and follow the suggested directions for either resolving your in-progress merge issues or resetting back to a not-in-the-middle-of-a-merge state.

查看更多
登录 后发表回答