Skip to content

Instantly share code, notes, and snippets.

@eudaimonious
Created January 13, 2014 18:16
Show Gist options
  • Save eudaimonious/8405236 to your computer and use it in GitHub Desktop.
Save eudaimonious/8405236 to your computer and use it in GitHub Desktop.
Merge and squash, stash alternative, delete branches, rebase
// Squash commits into a new branch before merging
git co staging && git pull
git co -b <similar topic name, e.g. topic-pr>
git merge --squash <original topic branch>
git add .
git commit -m "REP-123: Story title"
git push <similar topic name>
// Go to GitHub issue my pr
// Blow away stuff I haven't committed
git reset --hard
// Delete remote branches
git push origin --delete <branchName>
// Delete local branches that are no longer on github
git remote prune origin
// Squash all commits before pushing
git rebase -i <a sha of the commit before your last commit>
// change all but one 'pick' to 'squash'
git commit --amend -m "New commit message"
git push origin -f <branch name>
git rebase -i HEAD~<number of commits to squash>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment