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.

4
  • 31
    The message will be different depending on whether the added file was already being tracked (the add only saved a new version to the cache - here it will show your message). Elsewhere, if the file was not previously staged, it will display use "git rm --cached <file>..." to unstage
    – leonbloy
    Commented May 6, 2013 at 18:25
  • Great! The git reset HEAD <file> one is the only one that will work in case you want to unstage a file delete Commented Feb 24, 2018 at 0:25
  • 4
    My git version 2.14.3 says git reset HEAD to unstage.
    – SilverWolf
    Commented Apr 23, 2018 at 19:16
  • 11
    Since Git v2.23 the message has changed yet again. It now says git restore --staged <file>. See my answer below for an update.
    – prosoitos
    Commented Nov 19, 2020 at 17:02