Zum Inhalt springen

Git Aufräumen

Aus Computech CMS Wiki
Version vom 9. Juni 2017, 07:03 Uhr von Andreas (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „Massnahmen, um im Git-repo Platz zu schaffen. ==Unbenutzte Programmfiles von GIT löschen== git gc --aggressive ==Alte commits abschneiden== Workaround, um…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)

Massnahmen, um im Git-repo Platz zu schaffen.

Unbenutzte Programmfiles von GIT löschen

git gc --aggressive


Alte commits abschneiden

Workaround, um alte Git-commits aus dem Repository zu löschen.

git checkout --orphan temp $1      #create a new branch without parent history
git commit -m "Truncated history"  #create a first commit on this branch
git rebase --onto temp $1 master   #now rebase the part of master branch that we want to keep onto this branch
git branch -D temp                 #delete the temp branch

git gc --aggressive                # aggressively collect garbage; may take a lot of time on large repos

Quelle: Stackoverflow: How do I remove the old history from a git repository?