# Get the last commit SHA
git log -1 --format='%H' # long sha
git log -1 --format='%h' # short shaGet the branch name only.
git rev-parse --abbrev-ref HEADList changed files.
# Including whitespace changes
git diff --name-only
# README.md
# script.sh# Excluding whitespace changes
git diff --name-only -w
# README.mdForce pull, basically. Do a hard reset on the current branch from the origin remote. Use with caution!
git reset --hard origin/devGet the latest release tag. Find the most recent tag beginning with "release-", followed by any number of digits.
git describe --tags --abbrev=0 --match "release-[0-9]*"
# release-55.11Move branch from previous name to main. Most often used to replace the now-archaic 'master' name.
git branch -M mainGet latest commit with the tag at $1.
git rev-list -n 1 --tags="$1"List all git tags in the repo.
git tag -lMove a file (and, critically, tell git where it went!).
git mv ./oldName.txt ./newName.txtList all branches.
git branchList all branches on remote.
git branch --remotes
# OR
git branch -r
# origin/main