other
Remove all commits and history with git commands
These git commands can be helpful if you want to remove git commits with their history.
# Clone the project - Replace below url with your repo or project url
git clone https://github/git_username/repo_name.git
cd myproject
# Remove .git folder to remove git management
rm -rf .git
# Now, re-initialize the repository:
git init
git remote add origin https://github.com/git_username/repo_name.git
git remote -v
# Add all the files and commit the changes:
git add --all
git commit -am "Initial commit"
# Force push update to the master branch of our project repository:
git push -f origin master
Was this helpful?
Similar Posts
- Delete a git branch from local and remote machines - commands
- Docker Commands for Build image and push to Google Cloud Run
- Brew basic commands
- Useful docker commands
- 30 Terminal Commands that every programmer must know
- Postgresql show all databases on current server
- [PyCharm] Comment and uncomment lines of code