Undo git add before the first commit

As git newbie, this was very tricky but it happens quite often.

You create a new project, say C# project. In case of rails, when you create a new project, it automatically creates .gitignore, but Visual Studio doesn’t. You do “git add . ” and suddenly you realise you staged so many unnecessary files like resharper cache, dlls, etc.

You don’t have any branch yet, as you din’t make the first commit. You can’t do “git reset .”

Anyway, to make a long story short, you have to

git rm -r --cached .

 

If you want to have more detailed version of a similar story, go to http://stackoverflow.com/a/682343/437961

Undo git add before the first commit

2 thoughts on “Undo git add before the first commit

  1. My developer is trying to persuade me to move to .net from
    PHP. I have always disliked the idea because of the expenses.
    But he’s tryiong none the less. I’ve been using WordPress on a number of websites for about
    a year and am anxious about switching to another platform.
    I have heard very good things about blogengine.net.

    Is there a way I can transfer all my wordpress content into it?
    Any kind of help would be really appreciated!

  2. Laurioe Huley lives annd works in Newbury Park, California with her husband and two daughters, ages 10 and 13.
    Self-Motivated – Often, workers are motivated to ggo to work every day simply to earn a paycheck or even simply not too get fired.
    We love doing it, but we spend a decent amount of time
    doing interviews, photo shoots, driving too meet reporters
    and stuff like that.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s