Git cheatsheet

Tomas Koutsky published on

1 min, 85 words

Break a commit

git rebase -i <id>^

edit a commit

git reset HEAD~

add + commit files selectively

git rebase --continue

Change the author of a commit

git rebase -i <id>^

edit a commit

git commit --amend --author="First Last <email@email>" --no-edit
git rebase --continue

Rename a branch

git checkout <old name>

Rename the local branch:

git branch -m <new name>

Perform following if pushed to remote:

git push origin -u <new name>
git push origin --delete <old name>