The official website of Bipul Raman

Delete all commit history in GitHub

No comments

Problem Scenario: You want to delete all commit history but keep the code in its current state.
Solution: In order to achieve this, Deleting .git folder may cause problems in your Git repository. Therefore follow below steps through command line to solve the above problem scenario.
Step 1: Checkout to some new branch
git checkout --orphan new_branch
Step 2: Add all the files
git add -A
Step 3: Commit the changes
git commit -am "commit message"
Step 4: Delete the master branch
git branch -D master
Step 5: Rename the current branch to master
git branch -m master
Step 6: Force update your repository
git push -f origin master
Note: This will not at all keep your old commit history.

No comments :

Post a Comment