Linked Questions
40 questions linked to/from How do I undo 'git add' before commit?
105
votes
2
answers
96k
views
Undo git add --all [duplicate]
I made a mistake and called git add -all, now all files are added. I did not make a commit and push. How can I undo my action?
35
votes
1
answer
20k
views
how to undo git add before commit [duplicate]
Possible Duplicate:
Undo git add before commit
When i was working on my project I accidently added files using the following command
git add file
I haven't yet run
git commit.
How can I undo ...
20
votes
2
answers
17k
views
Undo multiple file and folder 'git add' [duplicate]
I executed
git add .
and now I want to revert that git add. How can I accomplish that?
15
votes
2
answers
30k
views
Remove all files for git commit? [duplicate]
Possible Duplicate:
Undo “git add”?
I made the mistake of running:
git add .
Which added important things such as .bashrc. Even though I run:
git rm .
When I run:
git push ...
13
votes
1
answer
2k
views
Unstage only new files using Git [duplicate]
I've accidentally staged a lot of changes including new files that I do not want to commit.
How can I unstage or reset only the new files?
I am not looking for a script of any kind; I am looking for ...
-1
votes
1
answer
241
views
What does git add * do and how to undo this [duplicate]
I performed the above command and seemed to lose some files. I want to know how to undo this command and get my files back.
1456
votes
19
answers
852k
views
How do I remove a single file from the staging area (undo git add)?
Situation: I have a Git repository with files already in the index. I make changes to several files, open Git and add these files to my staging area with "git add ."
Question: How do I remove one of ...
1484
votes
15
answers
1.4m
views
Why there are two ways to unstage a file in Git?
Sometimes git suggests git rm --cached to unstage a file, sometimes git reset HEAD file. When should I use which?
D:\code\gt2>git init
Initialized empty Git repository in D:/code/gt2/.git/
D:\code\...
1267
votes
17
answers
1.5m
views
How to remove files from git staging area?
I made changes to some of my files in my local repo, and then I did git add -A which I think added too many files to the staging area. How can I delete all the files from the staging area?
After I do ...
296
votes
19
answers
179k
views
'git status' shows changed files, but 'git diff' doesn't
I've had a look at all similar questions. However, I've double checked and something strange is definitely happening.
On one server (Solaris with Git 1.8.1) I cloned the Git repository then copied ...
206
votes
11
answers
205k
views
How can you undo the last git add?
Is it possible to unstage the last staged (not committed) change in git? Suppose there were a lot of files in the current branch, some staged, some not. At some point, some foolish programmer ...
303
votes
4
answers
131k
views
HEAD and ORIG_HEAD in Git
What do these symbols refer to and what do they mean?
(I can't find any explanation in official documentation)
254
votes
5
answers
309k
views
What is `git restore` and how is it different from `git reset`?
When I want to unstage a staged file, all of my Git tutorials show something like:
$ git add *
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." ...
65
votes
14
answers
114k
views
Git error, need to remove large file
I am getting this error when I try to push to git and I have no idea how to fix it.
Counting objects: 1239, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1062/1062), done.
...
66
votes
7
answers
104k
views
Commit changes only in one directory in Git
I'm using Git 1.7.4.1 on Mac 10.6.6. From the command line, how do I commit changes in only a single directory? I added the directory by doing:
git add my-dir
but doing
git commit -a
brings up a ...