Skip to content

Files

Latest commit

 

History

History
35 lines (24 loc) · 734 Bytes

git_commands.md

File metadata and controls

35 lines (24 loc) · 734 Bytes

A useful collection of Git commands Back

  1. List all authors inside a project:

    git shortlog --summary --numbered --email 
    git shortlog -sne 

    To show all branches:

    git shortlog -sne -all 
  2. List logs with a colourful graph:

    git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ai) %C(bold blue)<%an>%Creset' --abbrev-commit
  3. Squash all commits into one:

    !f(){ git reset $(git commit-tree HEAD^{tree} -m \"${1:-A new start}\");};f "commmit message" 
  4. Show lines of differences between two commits:

    git diff --shortstat