📘
Git-Help
Git Cheatsheet
  • A Simple Git Help
  • Basics
  • Git Branching
  • Pull Request
  • Submodules
  • Commands / Actions
    • Commit changes to other branch
    • git log
    • git status
    • git init
    • Amend a commit
    • Reset a file or full
    • Undo git add
    • Get remote repo url
    • Add or Set Remote URL
    • delete branch
  • Credits & Other
    • Other good links
    • Credits
Powered by GitBook
On this page

Was this helpful?

  1. Commands / Actions

Undo git add

How to undo/remove file after 'git add'

PreviousReset a file or fullNextGet remote repo url

Last updated 3 years ago

Was this helpful?

Lets say you mistakenly added a file using the following command.

git add abc.txt

To undo adding run the following.

git reset HEAD abc.txt

Dont do git reset, you will loose changes

git reset abc.txt    < ---- DONT DO THIS

https://stackoverflow.com/questions/348170/how-do-i-undo-git-add-before-commit