Misc Git Tips¶
How to “reboot” a repository¶
git checkout --orphan latest_branch
git add README.md
git commit -m "Init repo" README.md
git add -A
git commit -m "Import from private repo"
git branch -D main
git branch -m main
git gc --prune=now
How to “undo” last commit¶
git reset --soft HEAD~1
How to merge commits¶
Use git rebase -i <after-this-commit> and replace “pick” on the second and subsequent commits with “squash” or “fixup”, as described in the manual.
#repository
Page last modified: 2026-01-26 09:31:10