Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

23
  • 30
    Hah. I followed this same process. Except I gave up and said rm -rf .git, git init because I didn't trust git rm --cached to keep my working copy. It says a little for how git is still overly complex in some places. git unstage should just be a stock standard command, I don't care if I can add it as an alias. Commented Mar 29, 2011 at 3:45
  • 8
    For me git says git reset HEAD <File>...
    – drahnr
    Commented Sep 12, 2012 at 6:50
  • 27
    git rm --cached <file> is actually the correct answer, if it is the initial import of <file> into the repository. If you're trying to unstage a change to the file, git reset is the correct answer. People saying that this answer is wrong are thinking of a different question. Commented Feb 28, 2013 at 22:14
  • 20
    This will actually work, but only on the first commit, where the file didn't exist before, or where the git add command added new files, but not changes to existing files.
    – naught101
    Commented Apr 10, 2013 at 2:33
  • 12
    just goes to show how unintuitive and convoluted git is. instead of having parallel "undo" commands, you have to find out how to undo them. Like trying to free your leg in quick sand, and then getting your arm stuck, then getting your other arm stuck... every command should be done through GUI, with dropdown menus items for the options... Think of all the UI, productivity gains we've had, but we have this mess of a retro command line interface. It's not like the git GUI programs make this any more intuitive.
    – ahnbizcad
    Commented May 24, 2014 at 10:54