Skip to content

Instantly share code, notes, and snippets.

@stouset
Created May 20, 2013 16:43
Show Gist options
  • Save stouset/5613489 to your computer and use it in GitHub Desktop.
Save stouset/5613489 to your computer and use it in GitHub Desktop.
git checkout -b $new_branch_name $branch_you_did_the_changes_on # create a new branch with all the changes
git checkout $branch_you_did_the_changes_on # go back to the branch you did the work on
git stash -u # stash all your changes and any new files
git status # confirm a "clean" state
git reset --hard master # reset your branch back to being unchanged from `master`
git checkout master
git merge $new_branch_name # merge in the changes from the new branch
git checkout $branch_you_did_the_changes_on
git rebase master # fast-forward to the new state of master
git stash pop # bring all your changes back
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment