Skip to content

Instantly share code, notes, and snippets.

@danlucraft
Created June 10, 2011 08:45
Show Gist options
  • Save danlucraft/1018487 to your computer and use it in GitHub Desktop.
Save danlucraft/1018487 to your computer and use it in GitHub Desktop.
# start work on new feature
git checkout -b my-new-feature
git add .
git commit -m "Implemented awesome new feature"
# push it up to my github account (origin is the remote for my github account)
git push origin my-new-feature
# make pull request now on github for this branch, and wait for it to get merged.
# later...
# it's been a while without being merged, and I want to keep my branch and pull
# request up to date with new stuff on master (redcar-org is the remote for the
# official redcar organization repo). So...
# update my master (this should be the ONLY way your master ever changes)
git fetch redcar-org
git checkout master
git rebase redcar-org/master
git push origin master
# and rebase new stuff onto my feature branch (keeps the branch clean with only
# my one commit in it - which now applies against the head of master)
git checkout my-new-feature
git rebase redcar-org/master
git push -f origin my-new-feature
# the pull request will update to reflect the state of the branch
# Now, if your branch has been downloaded and used by other people, push
# forcing will confuse them. That's unlikely for most branches you make however.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment