COMMANDPURPOSEAFFECTSRISKgit initRepository
Create an empty Git repository.git init
repository, HEAD, refs Safegit statusInspect
Show working tree and staging area state.git status
working tree, index Safegit addStaging
Copy file changes into the staging area.git add <path>
index, snapshot Changes indexgit commitHistory
Create an immutable snapshot from staged changes.git commit -m "message"
commit, parent, tree Changes historygit switchBranches
Switch branches or create a new branch.git switch [-c] <branch>
HEAD, branch ref Changes filesgit mergeBranches
Join another line of history into the current branch.git merge <branch>
fast-forward, merge commit Changes historygit resetRecovery
Move a branch reference and optionally reset index and files.git reset [--soft|--mixed|--hard] <commit>
refs, index, working tree Potentially destructivegit reflogRecovery
Inspect recent movements of HEAD.git reflog
reflog, recovery SafetouchLinux
Create a file or update its timestamp.touch <file>
filesystem Changes filesechoLinux
Print text, often with redirection into a file.echo "text" > file
stdout, redirection Changes filesgrepLinux
Filter lines that match a pattern.grep <pattern> [file]
pipes, text SafermLinux
Remove files from the virtual filesystem.rm [-r] <path>
filesystem Potentially destructive