Undoing a git rebase

The easiest way would be to find the head commit of the branch as it was immediately before the rebase started in the reflog… and to reset the current branch to it (with the usual caveats about being absolutely sure before reseting with the –hard option). Suppose the old commit was HEAD@{2} in the ref … Read more

Delete commits from a branch in Git

Careful: git reset –hard WILL DELETE YOUR WORKING DIRECTORY CHANGES. Be sure to stash any local changes you want to keep before running this command. Assuming you are sitting on that commit, then this command will wack it… The HEAD~1 means the commit before head. Or, you could look at the output of git log, … Read more