revert last commit
git reset HEAD~
git reset HEAD~
git reset --hard origin/<current-branch>
(equivalent to deleting and recreating the current branch)
git reset --hard origin/main
git branch
git checkout -b <name>
git checkout -
git branch -m <oldName> <newName>
git branch -d <name>
git push --set-upstream origin <name>
git add .
git reset .
git stash
git stash list
git stash drop
git stash pop
(while on target branch)
git rebase develop
if you want to push to existing repository, force is needed
git push --force
git checkout .
git checkout HEAD <file>
git commit --amend
git reset --soft HEAD~1
(e.g. n = 4)
git reset --soft HEAD~4
git clean -di
git remote prune origin
git gc
git tag -l | xargs git tag -d
git fetch --tags
git tag <newName> <oldName>
git tag -d <oldName>
git push origin :refs/tags/<oldName>
git push --tags