Git Commands

Summary

This note is a quick reference for common Git commands used in everyday work. It is meant for fast recall, while fuller setup and workflow explanations stay in the related guides.

When to use this note

  • when you remember the Git task but need the exact command quickly
  • when you want a small daily workflow reminder without reopening a full concept note
  • when you need a fast setup or verification check

Setup and verification

CommandPurpose
git --versionshow installed Git version
git config --global user.name "Your Full Name"set Git username
git config --global user.email "your.email@example.com"set Git email
git config --global --listshow current global Git config
git config --list --show-originshow config values and where they come from
ssh -T git@github.comtest GitHub SSH authentication

Clone and repository basics

CommandPurpose
git clone git@github.com:USER/REPO.gitclone a repository over SSH
git remote -vshow configured remotes
git statusshow current repository state

Daily workflow

CommandPurpose
git add .stage modified and new files in the current repo
git commit -m "message"create a commit with a message
git push origin mainpush local commits to the remote branch
git log --onelineshow compact commit history

Example sequences

First check inside a repository

git status
git remote -v
git log --oneline -5

Small daily save-and-push flow

git add .
git commit -m "Update note content"
git push origin main

Notes

  • git add . is convenient, but it stages everything in the current repository scope
  • git config --list --show-origin is one of the best commands for debugging confusing config
  • git log --oneline is a fast way to inspect history without too much noise

Official documentation

Common mistakes

  • staging too much with git add . without checking git status
  • pushing before confirming the correct remote and branch
  • debugging Git config without checking where a value actually comes from