Git Commands

Various git commands. This is a WIP.

This is a WIP

git-add

git-commit

git-merge

git-log

  • git log --oneline
  • git log --stat
  • git log -p
  • git shortlog - groups commits by user
  • git log --graph --oneline --decorate - the golden command

Additional resources: https://www.atlassian.com/git/tutorials/git-log

git-blame

git-diff

git-show

Show information about various objects

git-restore

Restore a file from a previous commit

git restore --source HEAD~1 FILE_NAME

Restore a file from HEAD

git restore FILE_NAME

Restore all files in the current directory from HEAD

git restore .

git-reset

git reset --soft COMMIT
git reset --hard COMMIT

Removing a commit

Delete the last commit: git reset --hard HEAD~1 Force push the changes: git push -f remote branch