My git cheat sheets (keep updating)

Stanley Meng
Jan 21, 2021

Maybe I should consider github for this kind of document…uh…anyway, let me go with Medium.

  • How many files are modified in the local repo, but with only file name
git ls-files -m | wc -l
  • Compare files in different branches
git diff <branch name a>:<file path>  <branch name b>:<file path>For instance: git diff v9700:Shared/copy_coredumps.rb v9800:Shared/coredump_check/copy_coredumps.rb
  • Adds currently tracked files (which have been modified) to the staging area and also checks if they have been deleted (if yes, they are removed from staging area). NOTE it does not stage new files
git add -u
  • Delete Branch

local branch: git branch -d < branch name>
remote branch: git push origin --delete <branch name>
  • TBD

--

--