When you have merge conflicts in git, they appear in the file like this:
<<<<
old
old
====
new
new
>>>>
Now, I have some changes on origin/master
I am going to merge into my local master
branch. If I just merge them normally, the new lines will just appear nicely into the file, since there are no conflicts.
However, I want changes to appear like those merge conflicts above, so I can see both the old and new lines where the conflicts are, surrounded by <<<<
and >>>>
, review every change manually and delete stuff that should go away.
How do I "provoke" such a conflict?
A workaround is doing git diff -U999999 original.txt > review.txt
, but then you have to delete a lot of -
and +
characters at the beginning of every line when reviewing the file.
before you commit, you can just do git diff path/to/file
to see what has changed.
You can easily setup a graphical tool to use when doing a diff or conflict resolution - see http://adventuresincoding.com/2010/04/how-to-setup-git-to-use-diffmerge for examples.
I use DiffMerge , and when doing a diff, this lets you remove your changes individually, which sounds like the behaviour you want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.