Skip to content

Instantly share code, notes, and snippets.

@inspector71
Last active January 14, 2018 02:00
Show Gist options
  • Save inspector71/c21c1ed7a6907de4461a3dbba502afa0 to your computer and use it in GitHub Desktop.
Save inspector71/c21c1ed7a6907de4461a3dbba502afa0 to your computer and use it in GitHub Desktop.
Git merge new / updated code into current branch, from another branch, keeping remote / central repo in mind
Git merge new / updated code into current branch, from another branch, keeping remote / central repo in mind
git checkout <hostOrReceivingBranch> # 1. If not already there, load the branch you'll merge code into
git pull origin <hostOrReceivingBranch> # 2. Update, get (pull) other people's changes to a remote or central (origin) branch
git merge <newOrUpdatedCodeBranch> # 3. Merge the code from your new / updated branch into the branch currently loaded
git push origin <hostOrReceivingBranch> # 4. Push your changes back to a remote / central (origin) branch for everyone to see
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment