merge conflict (Local)
Why does merge conflict occur?
If we do commit in the master branch with the same files which are used to commit in other feature branches.
How do resolve the conflict?
If the project is already opened in visual studio code, then the editor will show the conflict files.
The editor will show the same as …
<<<<<<< HEAD
This is for testing merge1. add text for testing merge in master
=======
This is for testing merge1.
This is for testing merge in BR-4.
>>>>>>> BR-4
1st method
To remove all the sections of the conflict file and write the new one.
2nd method
Accept Current Change = change in master branch.
Accept Incoming Change = change in the feature branch.
Accept Both Changes = accept the changes for both the master branch and the feature branch.
Click any of the buttons according to the requirements.
Final Task
After doing all the above things…
Type the two commands like
git add .
git commit → a new terminal window will open → change the commit if you want or keep it as it was.
######################################################
######################################################
merge conflict (Remote) during git pull
If we change a file of a branch in a remote git repository. In the local git repository, we change another file in the same branch, and no conflict will occur.
But when we change the same file of the same branch in the local git repository and as well as in the remote git repository, then the conflict will occur.
Command to show the files which have been conflicted…
git ls-files -s
Commit…
git commit -a → nano editor can open → edit the commit message if you wish or keep it as it was.
Show the commit message…
git log
Post a Comment