I am using git remove git rm
. I made the simple/stupid mistake of manually deleting a folder with all the files in it BEFORE I used git rm
.
Now I have >15 files that I want to delete from my repo but NOT type out.
Is there a way to do this?
git status
deleted: Literature/abc.md
deleted: Literature/acdf.pdf
deleted: Literature/dsfsdf.pdf
deleted: Literature/dfgdfs.pdf
deleted: Literature/sgadfgaa.md
deleted: Literature/sdsds.pdf
deleted: Literature/sddvasds.rmd
deleted: Literature/ddsds.md
deleted: Literature/fsdfsdsd.png
Yes they're deleted from your worktree , but these files were saved in last revision*, so you just have to restore these files as they were at last commit :
git checkout -- full/path/to/Literature/
then rm
them as you intended in the first place.
* (unless these are new added files but you didn't say so)
If you have no other changes currently, and you are sure you need to revert back to the last committed state,
you can use , git reset --hard
which moves the HEAD to last committed hash and discarding all your local changes after that commit
Or, safer way is to do a git reset {path to your deleted folder}
first, to make the files unstaged for next commit, and then doing git checkout -- {path to your deleted folder}
as suggested by @RomainValeri
You can use the command
git rm -r --cached
For more details follow the link Bit Bucket Documentation
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.