Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove all files for git commit? [duplicate]

Tags:

git

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 project master

Everything still is added. I've even reinstalled git, but I am still pestered by this. A solution I found was to start over and remove all the files from the commit. Are there any other things I could do to remove all the files from the commit?

like image 909
Mohit Deshpande Avatar asked Nov 16 '10 02:11

Mohit Deshpande


People also ask

How do I remove all files from a remote git repository?

In order to delete files recursively on Git, you have to use the “git rm” command with the “-r” option for recursive and specify the list of files to be deleted. This is particularly handy when you need to delete an entire directory or a subset of files inside a directory.


2 Answers

Use git reset.

like image 158
ThiefMaster Avatar answered Oct 02 '22 20:10

ThiefMaster


You can use git reset to unstage changes, or even git reset --hard HEAD~ to blow away the most recent commit (careful with that one, it will not even keep your changes around.)

See http://git-scm.com/docs/git-reset

like image 23
David Winslow Avatar answered Oct 02 '22 20:10

David Winslow