Search...

Sunday, September 25, 2022

Rewriting Git History Cheat Sheet

$ git commit --amend
Replace the last commit with the staged changes and last commit combined. Use with nothing staged to edit the last commit’s message.
 
$ git rebase <base>
Rebase the current branch onto . can be a commit ID,a branch name, a tag, or a relative reference to HEAD.
 
$ git reflog
Show a log of changes to the local repository’s HEAD. Add --relative-date flag to show date info or --all to show all refs.

No comments: