Skip to content

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 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.

Page last modified: 2024-09-23 10:44:44