git diff --pager=<pager>Show unstaged changes with the output forced through a specific pager program.
git diff <branchname1>..<branchname2>Show all code changes between two branches as a unified diff.
git push <remote> <branchname>Upload local commits for a specific branch to a chosen remote repository.
git log --pretty=format:<format_string>Show commit history with a fully customized output format.
git rebase -i <commit>~<number>Interactively rewrite the last `<number>` commits before `<commit>` to edit, squash, reorder, or drop them.
git log --author=<author>Show commit history filtered to only those made by a specific author.
git remote set-url <remote> <url>Change the URL of an existing Git remote.
git bundle list-heads <path>Show the branch and tag heads stored in a Git bundle file.
git blame -w file.txtShows who last modified each line in file.txt, ignoring whitespace-only changes.
git blame -C -C <path>Annotate each line of a file with its last commit and author, tracking code copies across files.
git check-ignore -v <path>Show why a specific file is ignored by `.gitignore` and which rule causes it.
git worktree listShow all worktrees linked to the current Git repository and their paths.
git remote get-url <remote>Show the URL used by a given Git remote (like `origin`).
git cat-file -t <hash>Display the type of a Git object specified by `<hash>`.
git bisect run <path>Automatically runs a script at each step of `git bisect` to find the commit that introduced a bug.
git amApply one or more patch files from email-style mbox input as local commits.
git diff --name-statusLists changed files with codes indicating added, modified, or deleted status.
git instawebLaunches a temporary local web server and opens your Git repository in a browser for quick browsing.
git fsckChecks the integrity and connectivity of objects in a Git repository.
git log --follow -- <path>Show the commit history for a single file, including before it was renamed or moved.
git bisect visualizeShow commits between the known good and bad revisions during a bisect session.
git branch --no-mergedList local branches that haven’t been merged into the current branch.
git fsck --lost-foundRecovers unreachable Git objects and places them in .git/lost-found for inspection
git bisect logDisplays the recorded steps of a Git bisect session
git reset --mergeAbort a merge and reset files to the previous HEAD while preserving unrelated local changes.
git archive --format=zip Create a ZIP archive of the repository’s files at a given commit or branch.
git archive --remote=<repo> <commit>Create a tar archive of a remote repository at a specific commit without cloning it.
git filter-branch --subdirectory-filter <dir_folder>Rewrite history so only the contents and history of a specific subdirectory remain in the repository.
git revert --no-commit <commit>Prepare a revert of a specific commit without creating the commit automatically.
git fetch <remote>Download new commits, branches, and tags from a specific remote without changing your current work.
git log --oneline --graphDisplays condensed repository history in a graphical format.
git checkout HEAD <path>Restore a file from the most recent commit
git add .Stage all changes in the current directory
git pull <remote>Fetches and merges remote changes into the current branch
git clone <repo_url> <local_repo_name>Creates a copy of a remote repository with a different name on your local machine
git push --force <remote>Forcefully updates the `origin` remote with your local commits, overwriting any conflicting history.
git restore --staged <path>Unstages the specified file/s
git restore .Reverts all uncommitted changes in the current directory.
git rm -f <path>Forcefully removes a file from the working directory and stages the deletion.
git commit -aCommits any changes to tracked files in the current repository.
git diff --stagedDisplays changes between the index and the last commit.
git status -sDisplay a short summary of the working directory's status
git pull --squashFetches and merges remote updates into your current branch as a single squashed commit.
git log --all -- <path>List complete commit history involving a specific file.
git add -pInteractively stage file changes
git shortlogSummarize git commit history by author.
git stash dropDelete the most recent stash entry
git tag -a <version_number>Creates an annotated Git tag named `<version_number>` pointing at the current commit.
git branch --contains <commit>List local branches that include the specified commit.
git log -G<regexp>Searches commit diffs for changes matching a regex pattern.
git branch --unset-upstreamRemove the upstream tracking branch from the current branch.
git log --merge --onelineDisplays commits relevant to the current merge in a concise one-line format.
git diff --name-only --diff-filter=UList filenames of files with merge conflicts
git switch -c <branchname>Creates a new branch and switches to it.
git apply <path>Apply a patch file’s changes directly to the working directory
git switch <branchname>Switch to the specified branch
git describe --tagsShows the nearest tag name reachable from the current commit.
git name-rev <commit>Shows a friendly reference name for a commit hash
git describe --always --dirtyShow a short identifier for the current commit, marking it 'dirty' if there are uncommitted changes.
git notes add -m <note-text>Add a note to the current commit without altering its history
git bundle create <filename> <branchname>Bundles the commit history of <branchname> into a single file named <filename>.
git notes show <commit>Displays the note text attached to a specific commit.
git fetch --dry-runPreview remote changes without actually downloading them.
git show-ref --headsShow commit hashes and reference names for all local branches.
git count-objects -vPrints counts and disk usage of loose and packed objects in the repository.
git branch --mergedList local branches fully merged into the current branch.
git bisect stopStops the bisect session and restores the repository to its original state.
git reflogShow a log of all Git references
git fetchDownload new commits, branches, and tags from the remote without changing your current files.
git checkout -b <branchname>Create a new branch and switch to it
git branch -m <old_branchname> <new_branchname>Rename a branch
git branch -vList all branches including commit information
git rebase <branchname>Replay your current branch’s commits on top of another branch to create a cleaner, linear history.
git checkout -b <branchname1> <remote>/<branchname2>Clone a remote branch and switch to it
git restore --stagedRemoves files from the staging area without altering their content in the working directory.
git checkout <branchname>Switch to a different branch
git branch -M <branchname>Forcefully rename the current branch to <branchname>
git branch <branchname>Creates a new branch with the specified name.
git merge <branchname>Merge the specified branch into the current branch, combining their histories.
git rm <path>Remove a file from the working directory and staging area.
git diff <commit> --name-onlyShow only the names of files that changed compared to a specific commit.
git add <path>Stages changes in the specified <path> so they are included in the next commit.
git rm --cached <path>Remove files only from the git index
git commit -m "<message>"Create a new commit with the staged changes and attach a message describing them.
git clone <repo_url>Download a remote Git repository to your local machine as a new directory.
git logShow the commit history
git blame <path>Show who last changed each line of a file and in which commit.
git pullFetch and merge remote changes
git initInitialize a Git repository in the current directory
git statusShow the status of the current repository
git diff HEADShow uncommitted changes
git add -AAdd all new and changed files to the staging area
git branchList all branches
git branch -d <branchname>Delete a branch
git push Upload local commits from your current branch to its configured remote branch.
git config pull.rebase falseConfigures Git to merge instead of rebasing when pulling changes.
git diff @{push}Compare your working directory to the commit recorded at your last push
git log --all --grep=<searchterm>Display all commits across branches whose message contains a specified keyword.