215 results
git log
Show the commit history
git pull <remote>
Fetches and merges remote changes into the current branch
git status
Show the status of the current repository
git diff --staged
Displays changes between the index and the last commit.
git branch -m <old_branchname> <new_branchname>
Rename a branch
git clone <repo_url>
Download a remote Git repository to your local machine as a new directory.
git restore .
Reverts all uncommitted changes in the current directory.
git reflog
Show a log of all Git references
git pull
Fetch and merge remote changes
git init
Initialize a Git repository in the current directory
git switch <branchname>
Switch to the specified branch
git checkout <branchname>
Switch to a different branch
git checkout -b <branchname>
Create a new branch and switch to it
git status -s
Display a short summary of the working directory's status
git branch -M <branchname>
Forcefully rename the current branch to <branchname>
git log -<number>
Shows the last `<number>` commits in the log.
git diff <commit> --name-only
Show only the names of files that changed compared to a specific commit.
git rm <path>
Remove a file from the working directory and staging area.
git branch -v
List all branches including commit information
git branch
List all branches
git push
Upload local commits from your current branch to its configured remote branch.
git fetch
Download new commits, branches, and tags from the remote without changing your current files.
git rm -f <path>
Forcefully removes a file from the working directory and stages the deletion.
git diff HEAD
Show uncommitted changes
git branch -d <branchname>
Delete a branch
git commit -a
Commits any changes to tracked files in the current repository.
git branch <branchname>
Creates a new branch with the specified name.
git switch -c <branchname>
Creates a new branch and switches to it.
git tag -a <version_number>
Creates an annotated Git tag named `<version_number>` pointing at the current commit.
git commit -m "<message>"
Create a new commit with the staged changes and attach a message describing them.
git restore --staged
Removes files from the staging area without altering their content in the working directory.
git add <path>
Stages changes in the specified <path> so they are included in the next commit.
git restore --staged <path>
Unstages the specified file/s
git add -A
Add all new and changed files to the staging area
git merge <branchname>
Merge the specified branch into the current branch, combining their histories.
git rm --cached <path>
Remove files only from the git index
git show-ref --tags
Show each tag name and its commit hash in the local repository.
git reset HEAD <path>
Unstage changes for a specific file or files
git blame <path>
Show who last changed each line of a file and in which commit.
git checkout HEAD <path>
Restore a file from the most recent commit
git reset <commit>
Reset the repository or a file to a specific commit
git diff HEAD HEAD^
Displays the differences between the two most recent commits.
git push -n
Show what would be pushed to the remote without actually pushing anything.
git add -p
Interactively stage file changes
git diff HEAD~ HEAD
Shows changes between the last and current commit.
git branch --merged
List local branches fully merged into the current branch.
git push <remote> -d <branchname>
Delete a remote branch
git clone <repo_url> <local_repo_name>
Creates a copy of a remote repository with a different name on your local machine
git stash pop
Applies the latest stashed changes to your working directory and removes that stash entry.
git branch -r
Lists all remote branches in the repository.
git push --force <remote>
Forcefully updates the `origin` remote with your local commits, overwriting any conflicting history.
git commit --amend -m "<message>"
Replace the most recent commit with a new one using an updated message and staged changes.
git diff --name-status
Lists changed files with codes indicating added, modified, or deleted status.
git log --oneline
View git commit history summarized
git diff HEAD --stat
View a summary of changes from the last commit
git log --follow -- <path>
Show the commit history for a single file, including before it was renamed or moved.
git checkout -- <path>
Restore a file in the working directory to the version from the current branch or index.
git prune
Removes unreachable objects
git stash push -m "<message>"
Stashes the changes in the working directory with a custom message.
git log --all --grep=<searchterm>
Display all commits across branches whose message contains a specified keyword.
git cherry-pick <commitA>
Apply the changes introduced by <commitA> on top of the current branch.
git remote add <remote> <url>
Add a new named remote pointing to a Git repository URL.
git branch -vv
List all branches with extra verbose information
git branch --no-merged
List local branches that haven’t been merged into the current branch.
git branch -D <branchname>
Delete a branch forcefully
git add .
Stage all changes in the current directory
git log ..<branchname>
Lists the commits that are available in <branchname> but not in the current branch
git show <commit>
Displays content changes of a specific commit
git stash
Temporarily saves changes that are not ready to be committed.
git revert <commit>
Revert the changes introduced by a specific commit
git diff --stat
View a summary of changes between your working directory and the staging area
git checkout -b <branchname1> <remote>/<branchname2>
Clone a remote branch and switch to it
git log --oneline --graph
Displays condensed repository history in a graphical format.
git reset -- <path>
Unstage changes for the specified `path` while keeping the working-directory edits intact.
git rebase <branchname>
Replay your current branch’s commits on top of another branch to create a cleaner, linear history.
git fetch <remote>
Download new commits, branches, and tags from a specific remote without changing your current work.
git push <remote> <branchname>
Upload local commits for a specific branch to a chosen remote repository.
git checkout -
Switch back to the previously checked-out branch
git notes add -m <note-text>
Add a note to the current commit without altering its history
git diff <branchname1>..<branchname2>
Show all code changes between two branches as a unified diff.
git stash drop
Delete the most recent stash entry
git log --all -- <path>
List complete commit history involving a specific file.
git branch --contains <commit>
List local branches that include the specified commit.
git count-objects -v
Prints counts and disk usage of loose and packed objects in the repository.
git shortlog
Summarize git commit history by author.
git stash save <message>
Stash changes with a custom message
git pull --squash
Fetches and merges remote updates into your current branch as a single squashed commit.
git cherry-pick --no-commit <commit>
Apply the changes from a specific commit to the current branch without creating a new commit.
git show <commit>:<path>
Display the contents of a file as it existed in a specified commit.
git show-ref
List all references (branches and tags) and their commit hashes.
git stash -u
Stash all changes including untracked files
git reset --hard HEAD~1
Undo last commit and discard changes.
git describe --tags
Shows the nearest tag name reachable from the current commit.
git describe --always --dirty
Show a short identifier for the current commit, marking it 'dirty' if there are uncommitted changes.
git branch --unset-upstream
Remove the upstream tracking branch from the current branch.
git checkout -m <branchname>
Switch to a different branch and merge changes
git fetch --dry-run
Preview remote changes without actually downloading them.
git stash clear
Remove all stashed entries
git blame -w file.txt
Shows 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 diff @{push}
Compare your working directory to the commit recorded at your last push
git apply <path>
Apply a patch file’s changes directly to the working directory
git check-ignore -v <path>
Show why a specific file is ignored by `.gitignore` and which rule causes it.
git checkout --theirs <path>
Resolve a merge conflict by accepting the "incoming" branch changes
git cat-file -p <commit>
Display a commit’s raw metadata and message in a readable form.
git worktree list
Show all worktrees linked to the current Git repository and their paths.
git bisect stop
Stops the bisect session and restores the repository to its original state.
git cherry-pick <commit-range>
Apply one or more existing commits from another part of the history onto the current branch.
git log -S <string>
Show commits that add or remove a specific string.
git filter-branch --subdirectory-filter <dir_folder>
Rewrite history so only the contents and history of a specific subdirectory remain in the repository.
git branch -a --contains <commit>
List all branches that contain commit <commit>, including remote branches.
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 instaweb
Launches a temporary local web server and opens your Git repository in a browser for quick browsing.
git checkout <commit> -- <path>
Restores a file or directory to its state from a specific commit.
git stash show -p
Shows the content of the last stash
git fsck
Checks the integrity and connectivity of objects in a Git repository.
git reset <commit> --merge
Undo commits without touching the working tree.
git mv -f <oldfilepath> <newfilepath>
Rename or move a file even if destination (i.e. <newfilepath>) exists
git bisect visualize
Show commits between the known good and bad revisions during a bisect session.
git cherry-pick <commitA>^..<commitB>
Cherry-pick several commits
git pull --ff-only upstream <branchname>
Fast-forward merge from `upstream` into current branch.
git reset --hard
Discard all changes and revert to the commit specified
git grep -i "search pattern"
Search for patterns in the repository, ignoring the case of the search pattern
git merge <branchname1> <branchname2>
Merge a branch into a target branch
git checkout --ours <path>
During a merge request choose the version of a file that existed in the current branch
git diff @{upstream}
Show differences between local branch and upstream branch
git log --since=<date_or_time>
Show commits since a specific date/time.
git tag <version_number>
Create a new tag with the specified version number
git show --name-status <commit>
Displays the names and status of files modified in a specific commit.
git push -u <remote> <branchname>
Push commits to a remote repository
git show-ref --heads
Show commit hashes and reference names for all local branches.
git ls-files
Lists all the files tracked by git
git rev-parse --symbolic-full-name --abbrev-ref HEAD
Obtain the name of the current branch
git bisect start
Start a binary search for a specific commit.
git config pull.rebase false
Configures Git to merge instead of rebasing when pulling changes.
git pull --rebase
Rebase the remote branch into the local one
git rebase <branchname> -i
Interactively rebase current branch onto `<branchname>`.
git --no-pager diff
Displays `git diff` output without pagination.
git stash -k
Stashes changes in the working directory, but keeps the untracked files
git clean -fd
Remove untracked files and directories from your git repository
git remote prune <remote>
Remove stale remote-tracking branches.
git gc
Clean up unnecessary files and optimize the local repository
git stash apply stash@{<number>}
Apply a specific stash to the working directory
git rebase -i --autosquash HEAD~n
Interactively rebase with autosquash for last n commits.
git reset --soft HEAD~1
Undo last commit, keep changes staged.
git reset --merge
Abort 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 config --global user.name <username>
Set your global Git username used to label your commits on this machine.
git archive --remote=<repo> <commit>
Create a tar archive of a remote repository at a specific commit without cloning it.
git revert --no-commit <commit>
Prepare a revert of a specific commit without creating the commit automatically.
git push
Uploads local commits from the current branch to its configured remote branch.
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 diff --pager=<pager>
Show unstaged changes with the output forced through a specific pager program.
git notes add -m "<message>"
Adds a new Git note with the given message to the current commit.
git rebase -i <commit>~<number>
Interactively rewrite the last `<number>` commits before `<commit>` to edit, squash, reorder, or drop them.
git cherry-pick --abort
Cancel an in-progress cherry-pick and restore the repo to its pre-cherry-pick state.
git cherry-pick --continue
Resume an in-progress cherry-pick after resolving conflicts.
git cherry-pick --edit <commit>
Apply a specific commit on top of the current branch while opening the commit message for editing.
git diff --name-only --diff-filter=U
List filenames of files with merge conflicts
git bisect run <path>
Automatically runs a script at each step of `git bisect` to find the commit that introduced a bug.
git remote get-url <remote>
Show the URL used by a given Git remote (like `origin`).
git stash --keep-index
Stashes changes, keeping index intact
git config --global user.name <username> --replace-all
Sets the global username for git, replacing any existing username
git diff <commitA> --name-status
Show the file names and status changes between commitA and the current branch
git pull --no-commit
Fetch and merge remote changes without auto-committing the merge
git remote set-head <remote> --auto
Automatically sets the default branch of a remote repository
git add --patch
Interactively select hunks of changes to stage for the next commit.
git fetch --prune
Fetches new branches and removes deleted branches
git revert HEAD
Reverts the most recent commit
git rev-list --all -- <path>
Lists commit hashes containing changes to a file.
git log --show-signature
Displays the git log with GPG signatures.
git blame -C
Display author's modifications per line in a file while copying or moving across files
git rev-list --all --objects
Lists all objects in all commits.
git blame -w
Displays who last modified each line of a file, ignoring whitespace.
git rev-parse
Resolve Git refs or paths into object names and directory info
git tag -a <version_number> -m "<message>"
Create an annotated tag with a specific version number and message
git merge --no-ff <branchname>
Merge branch without fast-forwarding
git push --tags
Pushes tags to the remote repository
git checkout --orphan <branchname>
Create a new orphan branch
git notes show
Displays the Git notes attached to the current commit or a specified object.
git pull --rebase --autostash
Fetch and rebase remote updates onto your branch while auto-stashing local changes
git merge-base <branchname1> <branchname2>
Finds common ancestor(s) between two branches
git stash push -p -m "<message>"
Stash changes interactively with a custom commit message
git log -p
Show the commit log with its diff
git config --global --list
List the global configuration settings for Git
git config --local --list
Show the local configuration settings for Git repository
git diff --histogram
Show file changes using a histogram algorithm that groups similar changes more intelligently.
git log --pretty=format:<format_string>
Show commit history with a fully customized output format.
git checkout -t <remote>/<branchname>
Create and switch to a new branch tracking a remote branch
git log --merge --oneline
Displays commits relevant to the current merge in a concise one-line format.
git reset --mixed HEAD~1
Undo last commit, keep changes staged
git fsck --lost-found
Recovers unreachable Git objects and places them in .git/lost-found for inspection
git fetch --tags
Downloads all remote tags without merging any branch changes.
git stash apply
Apply the most recent stash to the working directory
git rebase --rebase-merges <branchname>
Rebase a branch incorporating merge commits.
git config --global push.default current
Set default tracking for new branches
git name-rev <commit>
Shows a friendly reference name for a commit hash
git add -i
Interactively add files to the git index
git log <commitA>..<commitB>
Show the commits that are reachable from the second commit but not from the first.
git blame -L <start,end> <path>
Displays the author and revision details for specific lines in a file.
git am
Apply one or more patch files from email-style mbox input as local commits.
git log -G<regexp>
Searches commit diffs for changes matching a regex pattern.
git config --global pager.branch false
Disables the use of a pager for the output of the `git branch` command globally.
git commit --no-verify
Commit changes without running pre-commit hooks
git cherry-pick -n <commitA>
Apply the changes in `<commitA>` without making a new commit.
git checkout -b <branchname> <commit>
Creates and switches to a new branch from a specific commit
git add --edit
Interactive staging of changes
git for-each-ref --sort=-committerdate
List all refs (branches, tags, etc.) ordered by most recent commit first.
git cat-file -t <hash>
Display the type of a Git object specified by `<hash>`.
git bundle list-heads <path>
Show the branch and tag heads stored in a Git bundle file.
git maintenance start
Starts Git's background maintenance tasks to optimize the repository.
git bisect log
Displays the recorded steps of a Git bisect session
git fast-import
Stream bulk history data into a Git repository at high speed using a specialized import format.