Git fix guide

I consider myself a fairly advanced user of Git.  I’ve been using it for most of the past 5 years and really enjoy the workflow improvements, and in the circles I run I am typically consulted when folks have a question about Git.  Of course, I couldn’t be nearly as effective without the help of others on the web.

For example, today I was looking for a way to remove a file from a commit that I hadn’t yet pushed, and my search led me to Seth Robertson’s page On undoing, fixing, or removing commits in git.  This page walks you through solutions by asking a series of questions about the current state of your repository and your changes.  Great guide!

Oh, and to remove a file from a commit, you can issue this command:

git reset HEAD^

which will undo the last commit, restoring your index to the previous commit, and leave the working directory with the changes uncommitted.

Leave a Reply

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