Skip to content

Instantly share code, notes, and snippets.

@jentanbernardus
Created November 28, 2019 01:21
Show Gist options
  • Save jentanbernardus/09926fb9c641e3d044f988e0e501d887 to your computer and use it in GitHub Desktop.
Save jentanbernardus/09926fb9c641e3d044f988e0e501d887 to your computer and use it in GitHub Desktop.
Merging branches via command line

Merging branches via command line

If you do not want to use the merge button or an automatic merge cannot be performed, you can perform a manual merge on the command line.

Step 1: From your project repository, bring in the changes and test.

git fetch origin git checkout -b branch-name origin/branch-name git merge master

Step 2: Merge the changes and update on GitHub.

git checkout master git merge --no-ff branch-name git push origin master

Optional: 1 liner 😉

git fetch origin && git checkout -b branch-name origin/branch-name && git merge master && git checkout master && git merge --no-ff branch-name && git push origin master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment