Home > Software engineering >  git reset HEAD on removed directory
git reset HEAD on removed directory

Time:07-24

ALL,

I am trying to revert following operations:

cd <my_proect> && rm mysql-connector-c && git rm mysql-connector-c

at least until I figure out how to update to the current version properly.

Trying to run git reset HEAD mysql-connector-c does not unstage it, because running git status still shows them green and ready to commit

I guess I can try to run git pull to bring that code back and undo the rm command.

But I was wondering if its possible to do without it

TIA!!

CodePudding user response:

You can use git restore

git restore --staged --worktree mysql-connector-c

--staged to restore the index and --worktree to restore the content.

Old way is to use git checkout

git checkout HEAD -- mysql-connector-c/
  • Related