commands.sh

git

all

Distributed version control system. Some subcommands such as `commit`, `add`, `branch`, `switch`, `push`, etc. have their own usage documentation.

More info →

Subcommands (125)

git abort

Abort an ongoing rebase, merge, or cherry-pick. Part of `git-extras`.

git add

Stage changed files for a commit.

git alias

Create shortcuts for Git commands. Part of `git-extras`.

git am

Apply patch files and create a commit. Useful when receiving commits via email. See also: `git format-patch`.

git annex

Manage files with Git, without checking their contents in. When a file is annexed, its content is moved into a key-value store, and a symlink is made that points to the content.

git annotate

Show commit hash and last author on each line of a file. See `git blame`, which is preferred over `git annotate`. `git annotate` is provided for those familiar with other version control systems.

git apply

Apply a patch to files and/or to the index without creating a commit. See also: `git am`.

git archive

Create an archive of files from a tree.

git authors

Generate a list of committers of a Git repository. Part of `git-extras`.

git bisect

Use binary search to find the commit that introduced a bug. Git automatically jumps back and forth in the commit graph to progressively narrow down the faulty commit.

git blame

Show what commit and author last modified each line of a file.

git branch

Main Git command for working with branches.

git browse

View an upstream repository in the default browser. Part of `git-extras`.

git brv

Print a list of branches, sorted by last commit date. Part of `git-extras`.

git bug

A distributed bug tracker that uses Git's internal storage, so no files are added in your project. You may submit your problems to the same Git remote you use to interact with others, much like commits and branches.

git bugreport

Capture debug information from the system and user, generating a text file to aid in the reporting of a bug in Git.

git bulk

Execute operations on multiple Git repositories. Part of `git-extras`.

git bundle

Package objects and references into an archive.

git changelog

Generate a changelog report from repository commits and tags. Part of `git-extras`.

git checkout

Checkout a branch or paths to the working tree.

git cherry

Find commits that have yet to be applied upstream.

git clean

Remove files not tracked by Git from the working tree.

git clear

Clear a Git working directory as if it was freshly cloned with the current branch including files in `.gitignore`. Part of `git-extras`.

git cliff

A highly customizable changelog generator.

git clone

Clone an existing repository.

git coauthor

Add another author to the latest commit. Since this command rewrites the Git history, `--force` will be needed when pushing next time. Part of `git-extras`.

git cola

A powerful Git GUI with a slick and intuitive user interface.

git column

Display data in columns.

git commit

Commit files to the repository.

git config

Manage custom configuration options for Git repositories. These configurations can be local (for the current repository) or global (for the current user).

git continue

This command is an alias of `git abort`.

git contrib

Display commits from an author. Part of `git-extras`.

git count

Print the total number of commits. Part of `git-extras`.

git cp

Copy an existing file to a new location, preserving history. Part of `git-extras`.

git credential

Retrieve and store user credentials.

git cvsexportcommit

Export a single `Git` commit to a CVS checkout.

git daemon

A really simple server for Git repositories.

git delta

List files that differ from another branch. Part of `git-extras`.

git describe

Give an object a human-readable name based on an available ref.

git diff

Show changes to tracked files.

git difftool

Show file changes using external diff tools. Accepts the same options and arguments as `git diff`. See also: `git diff`.

git effort

Display how much activity a file has had, showing commits per file and "active days" i.e. total number of days that contributed to the file. Part of `git-extras`.

git extras

Git extension pack.

git fame

Pretty-print Git repository contributions.

git feature

Create or merge feature branches. Feature branches obey the format feature/name.

git fetch

Download objects and refs from a remote repository.

git flow

A collection of Git extensions to provide high-level repository operations.

git fork

Fork a GitHub repo. Like `git clone` but forks first. Part of `git-extras`.

git fsck

Verify the validity and connectivity of nodes in a Git repository index. Note: Does not make any modifications. See also: `git gc`.

git gc

Optimise the local repository by cleaning unnecessary files.

git graft

Merge commits from a branch into another branch and delete the source branch. Part of `git-extras`.

git grep

Find strings inside tracked files in a repository. Accepts a lot of the same flags as regular `grep`.

git gui

A GUI for Git to manage branches, commits, and remotes, and perform local merges. See also: `git-cola`, `gitk`.

git guilt

Show total blame count for files with unstaged changes or calculate the change in blame between two revisions. Part of `git-extras`.

git help

Display help information about Git.

git ignore

Show/update `.gitignore` files. Part of `git-extras`. See also: `git ignore-io`.

git imerge

Perform a merge or rebase between two Git branches incrementally. Conflicts between branches are tracked down to pairs of individual commits, to simplify conflict resolution.

git info

Display Git repository information. Part of `git-extras`.

git init

Initialize a new local Git repository.

git instaweb

Helper to launch a GitWeb server.

git lfs

Work with large files in Git repositories.

git lock

Lock a file in a Git repository from being modified by a commit. Part of `git-extras`. See also: `git-unlock`.

git locked

List locked files in a Git repository. Part of `git-extras`.

git log

Show a history of commits.

git magic

Automate add, commit, and push routines. Part of `git-extras`.

git mailinfo

Extract patch and authorship information from a single email message.

git maintenance

Run tasks to optimize Git repository data.

git merge

Merge branches.

git mergetool

Run merge conflict resolution tools to resolve merge conflicts.

git missing

Show commits which aren't shared between two branches. Part of `git-extras`.

git mktree

Build a tree object using `ls-tree` formatted text.

git mr

Check out GitLab merge requests locally. Part of `git-extras`.

git mv

Move or rename files and update the Git index.

git notes

Add or inspect object notes.

git obliterate

Delete files and erase their history from a Git repository. Part of `git-extras`.

git p4

Import from and submit to Perforce repositories.

git paste

Send commits to a pastebin site using `pastebinit`. Part of `git-extras`.

git pr

Check out GitHub pull requests locally. Part of `git-extras`.

git prune

Git command for pruning all unreachable objects from the object database. This command is often not used directly but as an internal command that is used by Git gc.

git psykorebase

Rebase a branch on top of another using a merge commit and only one conflict handling. Part of `git-extras`.

git pull

Fetch branch from a remote repository and merge it to local repository.

git push

Push commits to a remote repository.

git reauthor

Change details about an author identity. Since this command rewrites the Git history, `--force` will be needed when pushing next time. Part of `git-extras`.

git rebase

Reapply commits from one branch on top of another branch. Commonly used to "move" an entire branch to another base, creating copies of the commits in the new location.

git reflog

Show a log of changes to local references like HEAD, branches, or tags.

git release

Create a Git tag for a release. Part of `git-extras`.

git remote

Manage set of tracked repositories ("remotes").

git repack

Pack unpacked objects in a Git repository.

git repl

Git REPL (read-evaluate-print-loop) - an interactive Git shell. Part of `git-extras`.

git replace

Create, list, and delete refs to replace objects.

git rerere

Reuse fixes for merge conflicts.

git reset

Undo commits or unstage changes by resetting the current Git HEAD to the specified state. If a path is passed, it works as "unstage"; if a commit hash or branch is passed, it works as "uncommit".

git restore

Restore working tree files. Requires Git version 2.23+. See also: `git checkout`, `git reset`.

git revert

Create new commits which reverse the effect of earlier ones.

git rm

Remove files from repository index and local filesystem.

git root

Print the root directory of the current Git repository. Part of `git-extras`.

git rscp

Reverse `git scp` - copy files from the working directory of a remote repository to the current working tree. Part of `git-extras`.

git scp

Copy files from the current working tree to the working directory of a remote repository. Part of `git-extras`. Uses `rsync` to transfer files.

git secret

Stores private data inside a Git repository. Written in Bash.

git sed

Replace patterns in git-controlled files using sed. Part of `git-extras`.

git setup

Create a Git repository in a directory and commit all files. Part of `git-extras`.

git shortlog

Summarizes the `git log` output.

git show

Show various types of Git objects (commits, tags, etc.).

git-sizer

Computes various Git repository size metrics and alerts you to any that might cause problems or inconvenience.

git squash

Squash multiple commits into a single commit. Part of `git-extras`.

git stage

This command is an alias of `git add`.

git stamp

Stamp the last commit message, with the possibility to reference the issues numbers from your bug tracker or link to its review page. Part of `git-extras`.

git standup

See commits from a specified user. Part of `git-extras`.

git stash

Stash local Git changes in a temporary area.

git status

Show the changes to files in a Git repository. List changed, added, and deleted files compared to the currently checked-out commit.

git stripspace

Read text (e.g. commit messages, notes, tags, and branch descriptions) from `stdin` and clean it into the manner used by Git.

git submodule

Inspect, update, and manage submodules.

git subtree

Merge subtrees together or split repository into subtrees.

git summary

Display information about a Git repository. Part of `git-extras`.

git svn

Bidirectional operation between a Subversion repository and Git.

git switch

Switch between Git branches. Requires Git version 2.23+. See also: `git checkout`.

git sync

Sync local branches with remote branches. Part of `git-extras`.

git tag

Create, list, delete, or verify tags. A tag is a static reference to a commit.

git touch

Create new files and add them to the index. Part of `git-extras`.

git undo

Undo recent commits. Part of `git-extras`.

git unlock

Unlock a file in a Git repository so it can be modified by a commit. Part of `git-extras`. See also: `git lock`.

git utimes

Change files modification time to their last commit date. Does not touch files that are in the working tree or index. Part of `git-extras`.

git var

Print a Git logical variable's value. See `git config`, which is preferred over `git var`.

git whatchanged

Show what has changed with recent commits or files. See also: `git log`.

git worktree

Manage multiple working trees attached to the same repository.

Options (3)

-A, --allboolean

Stage all changes for a commit

Example: git add {{[-A|--all]}}
-m, --messageboolean

Commit changes to version history

Example: git commit {{[-m|--message]}} {{message_text}}
-f, --forceboolean

Reset everything the way it was in the latest commit

Example: git reset --hard; git clean {{[-f|--force]}}

Examples (8)

Create an empty Git repository

Clone a remote Git repository from the internet

git clone https://example.com/repo.git

View the status of the local repository

Stage all changes for a commit

git add [-A|--all]

Commit changes to version history

git commit [-m|--message] message_text

Push local commits to a remote repository

Pull any changes made to a remote

Reset everything the way it was in the latest commit

git reset --hard; git clean [-f|--force]
made by @shridhargupta | data from tldr-pages