Git

Table of contents

  1. Git commands
    1. View commit history
    2. Archive from commit history
  2. Other commands
    1. Updating Git

Git commands

View commit history

  • List all commits (in the active branch)
git log
  • List all commits (in all branches)
git log --all
  • List only x commits
    • git log -p -x
git log -p -2
  • List commits by author
    • git log –author=”"
git log --author="Ricardo Paiva Moinhos"
  • List changes in file (in the active branch)
    • git log – “"
git log -- "c:\repo\file.cs"
  • List changes in file (in all branches)
    • git log –all – “"
git log -all -- "c:\repo\file.cs"
  • List changes in any file in a folder (in all branches)
    • git log –all – “"
git log -all -- "c:\repo\"
  • List changes in file (even if it was renamed, deleted, and doesn’t exist)
  • git log –follow – “"
git log --follow -- "c:\repo\file.cs"

Archive from commit history

  • Archive specific commit to a zip file
    • git archive -o <output path + filename>
git archive -o "C:\repo\archive.zip" 53da8a72f08a8c9dc862b7683b07d9ea965ae91a
  • Archive specific commit and specific subfolder to a zip file
    • git archive -o <output path + filename>
git archive -o "C:\repo\archive.zip" 53da8a72f08a8c9dc862b7683b07d9ea965ae91a "app"

Other commands

Updating Git

  • Update Git in Windows
git update-git-for-windows