Git - truncate history

Moki Lv6

Remove all commit and force push to server.

1
2
3
4
5
6
7
8
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
git checkout --orphan truncated_branch
git add -A
git commit -am "TRUNCATED HISTORY"
git branch -D "$CURRENT_BRANCH"
git branch -m "$CURRENT_BRANCH"
git push -f origin "$CURRENT_BRANCH"
git branch -D "truncated_branch"
On this page
Git - truncate history