Initial Checks

git status --short
git diff
git log --oneline -10

Editing and Cleaning Up Commits

Use these commands for commits that have not been shared.

git commit --amend
git rebase -i HEAD~3
# Include the initial commit
git rebase -i --root

After resolving conflicts, stage only the resolved files and continue. Use rebase --abort to cancel.

git add path/to/resolved-file
git rebase --continue
# Cancel the entire rebase
git rebase --abort

Choosing an Undo Method

Updating from the Remote

git fetch origin
git log --oneline HEAD..origin/main
git pull --ff-only

Avoid force-pushing shared branches. If a rebased personal branch must be pushed, verify the target and remote changes before using force-with-lease. It is not unconditionally safe: background fetches can affect its expected value.

New Repository

git init -b main
git add README.md
git commit -m "Initial commit"
git remote add origin <REPOSITORY_URL>
git push -u origin main
Powered by Fruition