Merging can sometimes be difficult, primarily when you have conflicts! Yikes!
Prerequisites: Add, commit, and push to your feature branch; then, attempt a merge into master. You’re left with conflicts. You are here!
First: From the command line, checkout your feature branch and attempt a merge so you can get a fresh copy of the merge conflicts.
$ git fetch origin $ git checkout -b property-create origin/property-create $ git merge master Auto-merging set_properties.py CONFLICT (content): Merge conflict in set_properties.py Auto-merging get_properties.py CONFLICT (content): Merge conflict in get_properties.py Auto-merging deploy.py CONFLICT (content): Merge conflict in deploy.py Automatic merge failed; fix conflicts and then commit the result.
Next: Open your favorite editor and visit one of those files.
Decide which changes you want to keep, and if need be, keep a little bit of both. Oftentimes, it’s one or the other…at least in my experience. When you’re finished with one file, save your changes and move to the next. Try to keep your changes specific to what is minimally needed to resolve the merge conflicts.
Finally: When you’re ready to try again:
[feature]$ git add deploy.py get_properties.py [feature]$ git commit -m 'fixed merge conflicts' [feature]$ git merge master Already up-to-date. [feature]$ $ git checkout master Switched to branch 'master' [master]$ git merge --no-ff property-create Merge made by the 'recursive' strategy. build_promoter.py | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------- set_properties.py | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------ 2 files changed, 126 insertions(+), 77 deletions(-) [master]$ git push origin master Counting objects: 8, done. Delta compression using up to 16 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 1.02 KiB | 0 bytes/s, done. Total 4 (delta 3), reused 0 (delta 0) remote: Resolving deltas: 100% (3/3), completed with 2 local objects. To git@github.com:build/pck-build.git 2ebfbe4..9115acf master -> master