3

By mistake I run the command

git add -A

and then (when I figured out) I stopped it using

Ctrl+C

Is there a way to reset the repository to the point before the git add -A?

git status shows:

# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
#
# Changed but not updated:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   deleted:    1xx_xx/xx.m~
#   modified:   2xx_xx/xx_xx.m
#   deleted:    3xx_xx/xx_xx.m~
#   modified:   4xx_xx/xx_xx.m
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   xx_xxvariables_ldac/
#   xx_xx/variables_ldac_template/
no changes added to commit (use "git add" and/or "git commit -a")
gabboshow
  • 5,359
  • 12
  • 48
  • 98

1 Answers1

5

Running git reset --mixed will reset the index which sounds like your goal.

Resets the index but not the working tree (i.e., the changed files are preserved but not marked for commit) and reports what has not been updated. This is the default action.

Peter Foti
  • 5,526
  • 6
  • 34
  • 47