Guest User

Untitled

a guest
Feb 15th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. Deleting the .git folder may cause problems in your git repository. If you want to delete all your commit history but keep the code in its current state, it is very safe to do it as in the following:
  2.  
  3. Checkout
  4.  
  5. `git checkout --orphan latest_branch`
  6.  
  7. Add all the files
  8.  
  9. `git add -A`
  10.  
  11. Commit the changes
  12.  
  13. `git commit -am "commit message"`
  14.  
  15. Delete the branch
  16.  
  17. `git branch -D master`
  18.  
  19. Rename the current branch to master
  20.  
  21. `git branch -m master`
  22.  
  23. Finally, force update your repository
  24.  
  25. `git push -f origin master`
  26.  
  27. PS: this will not keep your old commit history around
Add Comment
Please, Sign In to add comment