Skip to content

Instantly share code, notes, and snippets.

@cbartlett
Created November 1, 2012 23:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cbartlett/3997549 to your computer and use it in GitHub Desktop.
Save cbartlett/3997549 to your computer and use it in GitHub Desktop.
git merge strategy
Pull in the latest commits:
$ git fetch
Rebase your branch on top of the remote master:
$ get rebase origin/master
Go back to master:
$ git checkout master
Fetch pulls down commits but doesn't apply them. So you need to put those commits on master:
$ git pull --rebase
Assuming no new commits were added between the time you rebased your branch to master and the above command then just:
$ git merge branch_name
Then push your shit up:
$ git push origin master
And delete your local branch:
$ git branch -d branch_name
And delete the remote branch:
$ git push origin :branch_name
...note the colon before your branch name, that basically says "push an empty reference to the branch", which deletes it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment