Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove all added files in GIT

Tags:

git

By mistake I used git add . so all files are added in staring area. I want to remove all those files from staring area.

I tried

git clean -fdx

git clean -df

but it isn't worked.

like image 675
Piyush Avatar asked Apr 22 '15 09:04

Piyush


People also ask

How do I remove files already added to git?

The easiest way to delete a file in your Git repository is to execute the “git rm” command and to specify the file to be deleted. Note that by using the “git rm” command, the file will also be deleted from the filesystem.

How do I remove everything from git?

Just run the rm command with the -f and -r switch to recursively remove the . git folder and all of the files and folders it contains. This Git repo remove command also allows you to delete the Git repo while allowing all of the other files and folder to remain untouched.


1 Answers

You can also do like this:

git reset . <-- will remove files from current index

git reset <filename> <-- for a specific file.
like image 176
Abu Shumon Avatar answered Sep 22 '22 01:09

Abu Shumon