I am curious about how to remove the first commit in git.
What is the revision before committing any thing? Does this revision have a name or tag?
If you want to keep other branches, but for example make the master
branch start anew without common history to other branches, one safe way to achieve this is to create a new repository, and push contents of that in your old one:
cd ..
git init newrepo
cd newrepo
# make some initial commits
git push ../oldrepo master:newmaster
This creates newmaster
branch in the old repository, with history that is not common with any of the other branches. Of course, you can just overwrite the master
as well, with git push -f
.
If you want to destroy all branches and all existing content, then just run
rm -rf .git/