How to force merge git?
There is a branch named demo that needs to be merged with the master branch. The below-mentioned commands can give the output:
Git pull origin demo
Git checkout master
Git merge demo
Git push origin master
When there are merge issues, git can overwrite changes in the master branch without offering merge prompt. Hence alterations in the demo branch must automatically overwrite changes in the master branch.
The following command can be used to force merge git:
Git fetch origin # update all our origin/* remote-tracking branches
Git checkout demo
git merge -s ours branch
git checkout master
git emerge -s ours origin/master
Git merge -s ours branch
Git push origin master.
These commands can overwrite the demo branch.
Also there is no method to merge without fixing the conflicts. You can verify the version from any of the branch you are merging through git checkout – ours or git checkout – theirs . If you are on the master branch merging in staging:
Git checkout master
Git merge staging
Git displays various conflicts:
…
CONFLICT : Readme.md
…
You can run the command to keep the version of Readme.md on the master branch.
Git checkout – ours readme.md You can include the master branch to the index to tag it as resolved. Git add Readme.md
The process can be repeated for every file you wish to erase from the emerge. After completion, commit using the following code:
Git commit -m “some_msg”
The Data Science Certification Training offered at JanBask Training provides courses similar to offline sessions, helping students attain a broad idea on the basic and advanced concepts related to Data Science. The students also get to know the ways to manage structured and unstructured data applying the intelligence to figure out substantial conclusions. JanBask Training makes you industry-ready to face the job market scenario, examining the provided data and creating proper insights from them.