Reset git history
rm -rf .git
git init
git add .
git commit -m "Initial commit"
git remote add origin <git-uri>
git push -u --force origin master
Written by Edoardo Rivello
Related protips
4 Responses
Why the hell anybody should do that?
over 1 year ago
·
We have a gitlab server and we use a git repo to version images, css and javascripts.
The hard disk is not to big, so we have to remove history sometimes.
We do this only for this git repo, don't worry ;)
over 1 year ago
·
@erivello: Then why not simply use git gc --prune=now
? Also using Git to version binary files is bad idea. Maybe it will be fixed in 2.0, but I bet that it won't.
over 1 year ago
·
Very interesting this 'git gc' command, tnks.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#