I’m working with a github and want to know about some specific actions.
How do I remove:
- all files and folders in the current branch with a single command?
- all the history in current branch?
- a folder “extra/” and a filename “config-empty.txt” in the all folders and subfolders in the current branch?
- a history of the specified file or folder?
- a folder which has an exclamation mark in the name? Like “!jeremy/”
Thanks for your time.
You could at least sort your questions, the history ones in a block and the removing ones in another.
So for questions 1,3,5 I would say, from the root of your repo:
rm -rf *thengit add -u *or insteadgit rm -rf *and then commit, in order to remove everythingor remove what you want, as you do in your preferred OS, then
git add -u *(update) and commit(for 3 and 5 specifically the question depends on your OS/filesystem, not Git, and I believe you can figure an answer on your own)
As for 2 and 4, why would you remove history? If you remove anything, you will not retrieve it (I mean if you migrate code, imagine you want to have an idea of what happened in the past). The only reason I would imagine is you added bad code and you want to go back in the time before you made the mistakes. In this case branch from your point back in the day and work from that point.
If you are determined to remove some history, you can probably go dig in the .git folder at the root of your repo/local copy and remove manually data, but I (and I am probably not the only one) highly not recommend it.