InterviewSolution
Saved Bookmarks
| 1. |
How to resolve conflicts in GIT? |
|
Answer» Suppose you are going to pull most recent from storehouse and run over clash with neighborhood duplicate. We should attempt to comprehend this situation with underneath PRECEDENTS : git pull origin master ( Trying to get the latest from REMOTE repo) From giturl/projectname * branch master -> FETCH_HEAD Updating b044a4a..gg36324 error: ENTRY abc' not uptodate. Cannot merge.A plainly specific file(abc) isn't up to date. Now you will attempt to set your nearby duplicates right by running beneath commands: git add abc git commit -m "added files " git pull origin master From giturl/projectname * branch master -> FETCH_HEAD Auto-merging abc CONFLICT (CONTENT): Merge conflict in abc Automatic merge failed; fix conflicts and then commit the result.So you decide to take a look at the CHANGES by running mergetool : git mergetool Then you realize that you would like to keep your copies rather than a remote copy as the remote copy is not up to date : git checkout --ours abc git checkout --theirs abc git add abc git commit -m "using theirs"And then we try a final time git pull origin master From giturl/projectname * branch master -> FETCH_HEAD Already up-to-date. |
|