1

Github enriches your repository with wiki pages, issues, starring and so on. Since I rewrote one of my applications, I'd like to use this fresh repository from now on while keeping the things around. I thought about removing all current remote branches except the master and force pushing the master of the new repository.

Would this remove the old commits from the remote? Are there any troubles I'd run into with this?

danijar
  • 32,406
  • 45
  • 166
  • 297

1 Answers1

1

Would this remove the old commits from the remote?

Any other commits not accessible from the master branch (that you are pushing) would still be there: pushing master alone does not remove the other branches at the remote repo, even if you have removed them in your local repo.

You need to push the deletion of those branches as well:

git push origin --delete branch

(assuming 'origin' is the name of the remote referencing your GitHub repo)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Is there a way to actually remove the commits? – danijar Oct 21 '14 at 11:37
  • @danijar you can write to GitHub support, for them to run a `git gc --aggressive --prune=now`, which would remove all the "dangling" commits (no longer referenced by any branch). See also http://stackoverflow.com/a/2116892/6309 – VonC Oct 21 '14 at 12:35
  • Okay I do understand now. I guess they already run this on a regular basis so that those files would be removed after some time, which is fine for me. Just to be sure, removing the commits would cover both deltas and added files, right? – danijar Oct 21 '14 at 20:29
  • @danijar yes, that would cover both. – VonC Oct 21 '14 at 20:36