Search syntax, flags, internal repository mechanics, and safety levels to prevent accidental data loss.
Creates an empty Git repository or reinitializes an existing one by creating a hidden .git directory.
git init [directory] [--initial-branch=<branch>]-b, --initial-branch <name>Use the specified name for the initial branch (e.g. main).--bareCreate a bare repository (no working directory, for shared servers).Updates the index (staging area) using the current content found in the working tree, preparing files for the next commit.
git add <pathspec>...-A, --allStage all files including modifications, untracked, and deletions.-p, --patchInteractively choose hunks of patch between index and work tree.-u, --updateStage only already-tracked modified and deleted files.Captures a snapshot of the project's currently staged changes and records it into the permanent commit graph with author details and a log message.
git commit -m "<message>" [options]-m <msg>Set the commit message directly from CLI.-a, --allAutomatically stage modified/deleted tracked files before committing.--amendReplace the tip of the current branch by creating a new commit.Re-applies commits on top of another base tip, creating a linear history instead of merge bubbles.
git rebase [-i] <upstream> [branch]-i, --interactiveLet the user edit the list of commits to rebase (squash, drop, reword).--continueRestart the rebasing process after resolving a merge conflict.--abortAbort the rebase operation and reset HEAD to the original branch state.Resets the index and working tree. Any changes to tracked files in the working tree since <commit> are discarded permanently.
git reset --hard [<commit>]--hardResets the index and working tree. Any changes in the working tree are discarded.--softDoes not touch index or working tree; only moves the HEAD branch pointer.--mixedDefault mode: resets the index but not the working tree.Reference logs record when the tips of branches and other references were updated in the local repository. Enables recovering 'lost' commits from bad rebases or hard resets.
git reflog [show] [<ref>]showShows the log of the reference (default is HEAD).expirePrunes older reflog entries (usually kept for 90 days).