martes, 12 de enero de 2010

resolve git merge conflicts

My first experience merging non trivial merges on git went ok, but I didn't wrote down the steps, so I already forgot them.

Here's a quick summary of the steps to follow (my second non automatic merge).
git pull
This pulls new updates to your local repo /working directory and notifies you there are conflicts that couldn't be automatically merged.
git mergetool
Opens your favourite $EDITOR with a 3-vertical panel split. Showing you local, merge and remote buffers. Edit the file and clean it.
git add fileWithConflict
git commit
Git knows what you're trying to do, so it will write the "merged from github...." for you.

git user manual explains how to do it fairly well. Of course, you can search on stackoverflow for user help. Many use rebase to "flatten" the branch history. That's up to you. Myself, I'm not confident enough to use those smart commands (Although git fans say that rebase is a git killer feature).

No hay comentarios: