vimdiff
for resolve merge conflicts. Based on this linkStep 1: Run following commands in your terminal
git config merge.tool vimdiff
git config merge.conflictstyle diff3
git config mergetool.prompt false
This will set vimdiff as the default merge tool.
Step 2: Run following command in terminal
git mergetool
Step 3: You will see a vimdiff display in following format
+----------------------+
| | | |
|LOCAL |BASE |REMOTE |
| | | |
+----------------------+
| MERGED |
| |
+----------------------+
These 4 views are
LOCAL – this is file from the current branch
BASE – common ancestor, how file looked before both changes
REMOTE – file you are merging into your branch
MERGED – merge result, this is what gets saved in the repo
You can navigate among these views using ctrl+w
. You can directly reach MERGED view using ctrl+w
followed by j
.
More info about vimdiff navigation here and here
Step 4. You could edit the MERGED view the following way
If you want to get changes from REMOTE
:diffg RE
If you want to get changes from BASE
:diffg BA
If you want to get changes from LOCAL
:diffg LO
Step 5. Save, Exit, Commit and Clean up
:wqa
save and exit from vi
git commit -m "message"
git clean
Remove extra files (e.g. *.orig) created by diff tool.
Read More:
- How to solve error: failed to push some refs to ‘[email protected]:……git pull conflict
- How to Solve failed Precondition Error: attempting to use uninitialized value beta1_power
- How to use matlab to solve equation
- How to solve oserror: [errno 98] address already in use and kill the python3 process
- FTP use get command 550 failed to open file, but use the put command to solve the problem
- The @ Autowired annotation in springboot is invalid in ordinary classes. How to solve and use the null pointer exception java.lang.nullpointerexception
- CONDA reports an error: conflict package conflict
- C#: How to Use Httpclient to upload files with other parameters
- How to Use Truffle to Deploy contracts on moonbeam
- How to Use qdbusinterface to call DBUS interface
- Tensorflow: How to use expand_Dim() to add dimensions
- How to use C # to get image format without system. Drawing. Common
- 0xc0000005: solution to access conflict when writing to location 0x00000000
- How to use scanner to accept char type characters in Java
- How to Use Apt get Command Under Mac OSX
- How to use Latex to Write Matrices
- How to Use ffmpeg to convert MP4 and other formats to MP3 format
- How to Use spatial in MAC
- How to use JavaScript in HTML
- How to use C + + function pointer array