How-to: Git Rebase

Adding here for my own purposes, but may be helpful to others. This rebases to master (or whatever branch) and then squashes all your commits into one commit! Sexy. 🙂


> git fetch --all
> git checkout [master]
> git pull
> git checkout [working branch name]
> git merge-base HEAD [master] 
> git reset --soft [hash] e.g.: 43e87200b8375fc5eba022ced353ab2917f2a746
> git status
> git commit -a -m "NOTES"
> git rebase [master]

Note: Only needed if conflicts between branch commit and master
> git add .
> git status
> git rebase --continue

> git diff origin/[working branch name]
> git push -f origin [working branch name]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.