Comment résoudre les conflits dans un dépôt Git

Mots clés : gitgit-mergemerge-conflict-resolutiongit-merge-conflictgit

meilleur 4 Réponses Comment résoudre les conflits dans un dépôt Git

vote vote

92

git config merge.tool vimdiff git config merge.conflictstyle diff3 git config mergetool.prompt false 
git mergetool 
  ╔═══════╦══════╦════════╗   ║       ║      ║        ║   ║ LOCAL ║ BASE ║ REMOTE ║   ║       ║      ║        ║   ╠═══════╩══════╩════════╣   ║                       ║   ║        MERGED         ║   ║                       ║   ╚═══════════════════════╝ 
:diffg RE 
:diffg BA 
:diffg LO 
vote vote

85

git fetch origin git pull origin master  From ssh://gitosis@example.com:22/projectname  * branch            master     -> FETCH_HEAD Updating a030c3a..ee25213 error: Entry 'filename.c' not uptodate. Cannot merge. 
git add filename.c git commit -m "made some wild and crazy changes" git pull origin master  From ssh://gitosis@example.com:22/projectname  * branch            master     -> FETCH_HEAD Auto-merging filename.c CONFLICT (content): Merge conflict in filename.c Automatic merge failed; fix conflicts and then commit the result. 
git mergetool 
git checkout --ours filename.c git checkout --theirs filename.c git add filename.c git commit -m "using theirs" 
git pull origin master  From ssh://gitosis@example.com:22/projectname  * branch            master     -> FETCH_HEAD Already up-to-date. 
vote vote

79

<<<<<<< Changes made on the branch that is being merged into. In most cases, this is the branch that I have currently checked out (i.e. HEAD). ||||||| The common ancestor version. ======= Changes made on the branch that is being merged in. This is often a  feature/topic branch. >>>>>>> 
diff common mine diff common theirs 
git log --merge -p <name of file> 
vote vote

63

git mergetool -t diffmerge . 
brew install caskroom/cask/brew-cask brew cask install diffmerge 
#!/bin/sh DIFFMERGE_PATH=/Applications/DiffMerge.app DIFFMERGE_EXE=${DIFFMERGE_PATH}/Contents/MacOS/DiffMerge exec ${DIFFMERGE_EXE} --nosplash "$@" 

Questions similaires