3

I want to do an explicitly bad thing. I have a project where I am the only developer and I want to put it on Github but it's littered with absolutely terrible commit message. I want to basically re-init the repo so that when I push it to the public repo it doesn't have my asinine comments.

I've considered just deleting the .git file(directory?) but that seems wrong, but of course what I am doing is also a terrible practice in and of itself so maybe that really is the bet route?

Patrick Cauley
  • 961
  • 2
  • 11
  • 20

1 Answers1

7

An interactive rebasde would allow you to review each commit message and change the ones you want:

git rebase --root -i

Or, as suggested, you can simply create a new repo and, using the --work-tree option, add everything from your old repo:

git init newrepo
cd newrepo
git --work-tree=/path/to/old/repo add .
git commit -m "Import old repo"
git push -u origin master
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250