2

I have just noticed that my computer name and personal email were used as alias and email instead of my GitHub username and email.

Is there a way to completely remove ALL commits as well as all the history from GitHub?

BrechtDeMan
  • 6,589
  • 4
  • 24
  • 25
Johny19
  • 5,364
  • 14
  • 61
  • 99

1 Answers1

3

Yes, there is! See below.

However, in this case you might also be interested to just replace your name and email address on all the commits: https://help.github.com/articles/changing-author-info/


From how to delete all commit history in github? and Make the current commit the only (initial) commit in a Git repository?

It depends on if you want to remove all configuration as well. If that's not an issue:

rm -rf .git
git init
git add .
git commit -m "Initial commit"
git remote add origin <github-uri>
git push -u --force origin master

You can save your .git/config before, then restore it after.


Alternatively, leave the code in its current state but remove everything before (by making a new branch the new 'master' branch)

git checkout --orphan latest_branch
git add -A
git commit -am "commit message"
git branch -D master
git branch -m master
git push -f origin master
Community
  • 1
  • 1
BrechtDeMan
  • 6,589
  • 4
  • 24
  • 25
  • I changed my email in a sourceforge git repo some time ago. For instructions for how downstream users should catch up look at the 2014-03-07 [news entry](http://atinout.sourceforge.net/news.html). – hlovdal Sep 23 '16 at 22:22