-- Remove the history from | |
rm -rf .git | |
-- recreate the repos from the current content only | |
git init | |
git add . | |
git commit -m "Initial commit" | |
-- push to the github remote repos ensuring you overwrite history | |
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git | |
git push -u --force origin master |
This comment has been minimized.
This comment has been minimized.
sandeep0402
commented
Jun 13, 2017
Really helpful, saved my day |
This comment has been minimized.
This comment has been minimized.
antoniocosentino
commented
Jun 29, 2017
thanks! |
This comment has been minimized.
This comment has been minimized.
alromh87
commented
Jul 10, 2017
Im afraid you can still reference specific "deleted" commits by hash, eventough they don't appear in history |
This comment has been minimized.
This comment has been minimized.
adeluccar
commented
Aug 4, 2017
This might be problematic with repositories with git submodules.
|
This comment has been minimized.
This comment has been minimized.
hennott
commented
Aug 18, 2017
This saved my day .. an is working "nearly" automatic. |
This comment has been minimized.
This comment has been minimized.
vgrange
commented
Aug 24, 2017
Warning : this does not delete pull request history (discussion, file changes). If you do this in order to delete sensitive data, you should better delete the github repo (along with all its pull request history etc..) and recreate a new one from scratch. |
This comment has been minimized.
This comment has been minimized.
devrepo
commented
Sep 17, 2017
Thanks it was very useful |
This comment has been minimized.
This comment has been minimized.
heshanlk
commented
Oct 10, 2017
Above didn't work but the following worked with more attributes during the push.
|
This comment has been minimized.
This comment has been minimized.
jayeshdshah
commented
Oct 12, 2017
Perfect !!! Just a small comment : |
This comment has been minimized.
This comment has been minimized.
artykbayevk
commented
Oct 18, 2017
Thanks, man! |
This comment has been minimized.
This comment has been minimized.
Issen007
commented
Nov 3, 2017
Great help, thanks. |
This comment has been minimized.
This comment has been minimized.
cvera08
commented
Nov 30, 2017
Thank you! |
This comment has been minimized.
This comment has been minimized.
kaindad
commented
Dec 27, 2017
Great help! Thank you |
This comment has been minimized.
This comment has been minimized.
ilangovane
commented
Jan 6, 2018
It works perfectly ! Thank you ! |
This comment has been minimized.
This comment has been minimized.
gitanupam
commented
Jan 25, 2018
Thanks! |
This comment has been minimized.
This comment has been minimized.
mr-speak
commented
Mar 6, 2018
•
This did work for me, but initially I ran into problems after the two last lines (with my account and repo name, of course):
After running the last command, which failed, I started to get error messages for every command I used. I was not allowed to push. For example:
In my case, the solution was to follow this guide to use HTTPS instead of SSH: |
This comment has been minimized.
This comment has been minimized.
paulxtiseo
commented
Apr 13, 2018
@heshanik, the |
This comment has been minimized.
This comment has been minimized.
galamach
commented
Apr 24, 2018
that was a great help, many thanks |
This comment has been minimized.
This comment has been minimized.
gustavomf-cit
commented
Jun 22, 2018
awesome! thanks for share it |
This comment has been minimized.
This comment has been minimized.
rahianeja
commented
Jun 26, 2018
Wonderful ! it worked |
This comment has been minimized.
This comment has been minimized.
dj458
commented
Aug 6, 2018
Thank you! This one works well! |
This comment has been minimized.
This comment has been minimized.
markstos
commented
Aug 6, 2018
I believe you need to delete and recreate the Github remote repo to completely remove the logs. See for example Recovering a commit from Githubs reflog. Using the Github API described there, you access commits that are stored on Github don't appear in the normal commit history on Github. With this method, you don't know have to know the SHA of a commit you are looking for. Also, if the project in question is public, it appears the API calls to review the history are also public. |
This comment has been minimized.
This comment has been minimized.
david-j-m
commented
Aug 19, 2018
Thanks Heshanlk this worked for me, after adding git remote rm origin before the line git remote add origin [repro address] 'cause I was receiving: |
This comment has been minimized.
This comment has been minimized.
PranoopMutha
commented
Aug 27, 2018
|
This comment has been minimized.
This comment has been minimized.
evan45245
commented
Sep 13, 2018
Worked great, useful! |
This comment has been minimized.
This comment has been minimized.
aioue
commented
Sep 20, 2018
•
for a |
This comment has been minimized.
This comment has been minimized.
jeffrade
commented
Oct 22, 2018
If you want an empty repom then pass the
or else you'll get the following message:
|
This comment has been minimized.
This comment has been minimized.
Miopas
commented
Nov 20, 2018
This worked for me. Thanks. |
This comment has been minimized.
This comment has been minimized.
rishi-shah
commented
Feb 3, 2019
Awesome. This worked for me. Thank you. |
This comment has been minimized.
This comment has been minimized.
harshblog150
commented
Feb 4, 2019
nice! |
This comment has been minimized.
splaisan commentedMay 15, 2017
thanks, very usefull