Ignore file permission changes:

git config core.filemode false


Merge multiple commits as one:

  • Put the to-be-squashed commits on a working branch(eg: temp-branch), if they aren’t already
  • Check out the target branch (e.g. master)
git checkout master
git merge --squash temp-branch
git commit


Find differences/changes:

  • git diff --staged - View Staged changes before commit
  • git diff origin/main..<localBranchName> - between remote and local branches
  • git diff <oldCommit>..<newCommit> - between two commits
  • git diff -w <fileName> - Ignore whitespace differences
  • git diff --stat - Lists total number of changes by file
  • git diff --numstat - Lists additions and deletions by file
  • git diff --shortstat - Lists total number of additions and deletions