"? I installed my first git repository and did the following, git init follo...">

Is it possible to return the command "git rm -r -f <directory>"?

I installed my first git repository and did the following,

git init

follow some git-config options to configure the remote server. Then i did

git add directory
git status

Oops, I added some files that I don’t need. Ok, so I have to git rm remove the directory from the commit list and start again

git rm directory

At this point, I had to read the console message and documentation correctly ... but did not. Therefore i ran

git rm directory -r -f

AND? Where did my directory go? Ah, okay, git deleted it so it wasn’t. So let's try

git status
git reset --hard

After unsuccessful attempts, error messages, and several web searches, I realized that I was wrong. I had to use

git rm -r --cached directory

, . . , .

, , , "--cached" ... . , / ( ).

?

+5
2

, / ( )

?

.

, .

. , git. .

:

Edit

.

git reset --hard , . , git fsck --lost-found, <path to repo>/.git/lost-found/. , other <path to repo>/.git/lost-found/. , .

. , , , ( git add .). , .

+6

​​ , , git , , 'git fsck -lost-found'. , "Local history" IDE, , :)

+1

All Articles