freeCodeCamp/guide/english/miscellaneous/how-to-undo-a-git-add/index.md

12 lines
420 B
Markdown

---
title: How to Undo a Git Add
---
# Undo git add
To undo `git add` before a commit:
Run `git reset <file>` or `git reset` to unstage all changes.
In older versions of git, the commands were `git reset HEAD <file>` and `git reset HEAD` respectively. This was changed in Git 1.8.2
<a href='http://stackoverflow.com/questions/348170/undo-git-add-before-commit/348234#348234' target='_blank' rel='nofollow'>Source</a>