I delete a file in my working directory. And then I do a 'git pull'. Another person in my team modify the same file and 'git push' to the HEAD.
So when I do a 'git rebase', I get a merge conflict something like 'CONFLICT git (delete)'
My question is how can I find out what changes did the another person in the team made to the file I 'delete'?
Thank you.
To see the beginning of the merge conflict in your file, search the file for the conflict marker <<<<<<< . When you open the file in your text editor, you'll see the changes from the HEAD or base branch after the line <<<<<<< HEAD .
When there is conflict during a merge or rebase, different versions of a file are available from:
respective branches:
$ git show HEAD:path/to/file
$ git show branch:path/to/file
as stages 1, 2, 3 in the index:
$ git ls-files --unmerged
# ...
$ git show :1:path/to/file
$ git show :2:path/to/file
There are also tools such as "git diff --cc
" and "git log --merge
".
See documentation for details.
Git keeps a copy of the state of upstream branches in your repository as "remote tracking" branches. If you do a git branch -r
you will see a list of all remote branches. Choose the one that corresponds to the branch you're working on, and do something like:
git diff HEAD^..origin/master
This should show you changes between your HEAD parent (assuming your delete was the last commit, modify as necessary) and the current state of the upstream branch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With