How to make conflict merge git

For merge conflicts in git, they appear in the file as follows:

<<<< 
  old
  old
====
  new
  new
>>>>

Now I have some changes to origin/masterI'm going to merge into a local branch master. If I simply combine them normally, new lines will simply display well in the file, as there are no conflicts.

However, I want the changes to be displayed as those merge conflicts above, so I can see both the old and new lines in which the conflicts are located, surrounded by <<<<and >>>>, view each change manually and delete the material that should go.

How can I “provoke” such a conflict?

The workaround does git diff -U999999 original.txt > review.txt, but then you have to remove a lot of character -, and +at the beginning of each line when viewing the file.

+5
source share
1 answer

before committing, you can just do git diff path/to/fileto see what has changed.

You can easily configure the graphical tool to use when performing resolution or conflict resolution - see http://adventuresincoding.com/2010/04/how-to-setup-git-to-use-diffmerge for examples.

I use DiffMerge , and when doing diff, it allows you to delete your changes yourself, which is like the behavior you want.

0
source

All Articles