• git status to see changes
  • git status -s View changes in simple mode
  • git status --ignored show ignored files
  • git log View logs
  • git log --oneline View logs in a single line
  • git log --stat Show detailed commit history
  • git reflog Show the last few commits for the current branch
  • git log <-number> [--pretty] [--oneline] Show past commits
  • git log --follow [file] Show file version history
  • git blame [file] Show who modified the specified file and when
  • git show [--name-only] <commit-id> Show changes to commits
  • git show [commit-id]:[file] Show the contents of a file when a commit was made
  • git log --grep <keyword> filter & search
  • git log --author <author-name> Query for a specific author
  • git log --after='<date>' --until='<date>' Find by date
    git log --oneline --after="2019-02-20" --until='2020-02-20'
    
  • git grep <keyword> [branch-name|tag-name] search
    git grep "Hello"
    git grep "Hello" v2.5
    
  • git diff shows the difference between the staging area and the workspace
  • git log -p [file] Show every diff associated with a given file
  • git diff --cached [file] Show the difference between the staging area and the previous commit
  • git diff [first-branch] [second-branch] Show the difference between two commits
  • git diff HEAD Show the difference between the workspace and the latest commit of the current branch
  • git shortlog -sn Show all users who have committed, sorted by number of commits
  • git diff --shortstat "@{0 day ago}" Shows how many lines of code you’ve written today
  • git log --graph --decorate --oneline Plot branch graphs