I have a project that contains traces to another project of myself that I\'ve used as a kind of a template project. Now I want to remove these traces entirely from the repositor
Assuming master
is at commit F
:
# create a new branch with D's content
$ git checkout --orphan temp
$ git commit
# rebase everything else onto the temp branch
$ git rebase --onto temp master
# clean up
$ git checkout master
$ git branch -d temp
If you want to completely remove the old loose objects (A
, B
, & C
), first make sure you have exactly what you want. This cannot be undone. Once you have confirmed it's what you want, run:
$ git reflog expire --expire=now --all
$ git gc --prune=now