Lately when I run git pull
in my master branch it occasionally gives the following merge error:
Trying simple merge with 7ff9b5...
Trying simple merge with 6872cd...
Simple merge did not work, trying automatic merge.
Auto-merging file.txt
ERROR: content conflict in file.txt
fatal: merge program failed
Automated merge did not work.
Should not be doing an Octopus.
Merge with strategy octopus failed.
However after this merge attempt there are files that aren't even in the master branch.
I can fix this issue using git reset
and pulling again but I was wondering where this head or commits where coming from how can I find this? I tried looking in gitk
and checking the local GitLab servers but I couldn't find anything.
You should be able to see an individual file's history with
git log <filename>
. This may help to identify your mystery files.For conflicts, the source of the conflict should be shown with the conflict markers:
It may also help to switch from a
git pull
workflow to agit fetch
workflow.fetch
updates your remote branch pointer (e.g.origin/master
) but does not automatically merge your local branch (e.g.master
). You can then usegitk --all
to visually compare the branches,git diff origin/master
to view changes in the terminal, etc.Once you are satisfied and want to incorporate your upstream changes, all you need to do is merge (e.g.
git merge origin/master
from themaster
branch). Generally,git pull
isgit fetch
followed bygit merge
.