Created
June 8, 2020 08:42
-
-
Save martinholub/beae90c5badb2d603898d0810e3c8c56 to your computer and use it in GitHub Desktop.
Merge git branches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/questions/449541/how-to-selectively-merge-or-pick-changes-from-another-branch-in-git | |
# merge branch SOURCE to DETINATION | |
git checkout DESTINATION | |
git merge --no-ff --no-commit SOURCE | |
# inspect and solve potential conflicts | |
git status | |
git diff --cached file1 | |
# can change fileX locally, save and commit it if desired | |
# if you want to keep local (DESTINATION) version of fileX: | |
git checkout HEAD fileX | |
# if you want ONLY the SOURCE version of fileX | |
git checkout SOURCE fileX | |
# finally commit, add message. | |
git commit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment