Rebase master into a branch. git checkout branchName git fetch git rebase origin/master Rebase a branch into a branch git checkout branchName git fetch git rebase origin/branchToRebase Rebase Example <sha> is the commit prior to the screw up. <branch_name> is the name of the branch you want to push the changes to. Note -f must be used to force git to not throw annoying error messages and make weird stuff happen to your branch. git rebase -i <sha> git checkout <sha> path/to/file.123.js git checkout <sha> path/to/file.132.js git checkout <sha> path/to/file.312.js git checkout <sha> path/to/file.321.js git checkout <sha> path/to/file.231.js git checkout <sha> path/to/file.213.js git commit --amend git push -f origin <branch_name> Remove Local Branches which Do Not Exist on Remote git fetch -p && \ for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; \ do git branch -D $branch; done