Prezto Git

Git

g

git

is short for "git"

Branch (b)

gb

Lists, creates, renames, and deletes branches

git branch

gba

Creates a new branch

git branch --all --verbose

gbc

Creates a new branch

git checkout -b

gbd

Deletes a branch

git branch --delete

gbD

Deletes the branch regardless of its push and merge status, so be careful using this one, see also "gbd"

git branch --delete --force

gbl

Lists branches and their commits, see also "gbv"

git branch --verbose

gbL

Lists all local and remote branches and their commits

git branch --all --verbose

gbr

Renames/moves a branch, see also "gbm"

git branch --move

gbR

Renames/moves a branch even if the new branch name already exists, see also "gbM"

git branch --move --force

gbs

Lists branches and their commits with ancestry graphs

git show-branch

gbS

Lists local and remote branches and their commits with ancestry graphs

git show-branch --all

gbv

Lists branches with verbose information about their commits

git branch --verbose

gbV

Lists branches with more verbose information about their commits

git branch --verbose --verbose

gbx

Deletes a branch, see also "gbd"

git branch --delete

gbX

Deletes a branch irrespective of its merged status, see also "gbD"

git branch --delete --force

Commit (c)

gc

Records changes to the repository

git commit --verbose

gca

Stages all modified and deleted files

git commit --verbose --all

gcm

Records changes to the repository with the given message

git commit --message

gcS

Records changes to the repository. (Signed)

git commit -S --verbose

gcSa

Stages all modified and deleted files. (Signed)

git commit -S --verbose --all

gcSm

Records changes to the repository with the given message. (Signed)

git commit -S --message

gcam

Stages all modified and deleted files, and records changes to the repository with the given message

git commit --all --message

gco

Checks out a branch or paths to work tree

git checkout

gcO

Checks out hunks from the index or the tree interactively

git checkout --patch

gcf

Amends the tip of the current branch using the same log message as HEAD

git commit --amend --reuse-message HEAD

gcSf

Amends the tip of the current branch using the same log message as HEAD. (Signed)

git commit -S --amend --reuse-message HEAD

gcF

Amends the tip of the current branch

git commit --verbose --amend

gcSF

Amends the tip of the current branch. (Signed)

git commit -S --verbose --amend

gcp

Applies changes introduced by existing commits

git cherry-pick --ff

gcP

Applies changes introduced by existing commits without committing

git cherry-pick --no-commit

gcr

Reverts existing commits by reverting patches and recording new commits

git revert

gcR

Removes the HEAD commit

git reset "HEAD^"

gcs

Displays various types of objects

git show

gcsS

Displays commits with GPG signature

git show --pretty=short --show-signature

gcl

Lists lost commits

git-commit-lost

gcy

Displays commits yet to be applied to upstream in the short format

git cherry -v --abbrev

gcY

Displays commits yet to be applied to upstream

git cherry -v

Conflict (C)

gCl

Lists unmerged files

git --no-pager diff --name-only --diff-filter=U

gCa

Adds unmerged file contents to the index

git add $(gCl)

gCe

Executes merge-tool on all unmerged file

git mergetool $(gCl)

gCo

Checks out our changes for unmerged paths

git checkout --ours --

gCO

Checks out our changes for all unmerged paths

gCo $(gCl)

gCt

Checks out their changes for unmerged paths

git checkout --theirs --

gCT

Checks out their changes for all unmerged paths

gCt $(gCl)

Data (d)

gd

Displays information about files in the index and the work tree

git ls-files

gdc

Lists cached files

git ls-files --cached

gdx

Lists deleted files

git ls-files --deleted

gdm

Lists modified files

git ls-files --modified

gdu

Lists untracked files

git ls-files --other --exclude-standard

gdk

Lists killed files

git ls-files --killed

gdi

Lists ignored files

git status --porcelain --short --ignored | sed -n "s/^!! //p"

Fetch (f)

gf

Downloads objects and references from another repository

git fetch

gfa

Downloads objects and references from all remote repositories

git fetch --all

gfc

Clones a repository into a new directory

git clone

gfcr

Clones a repository into a new directory including all submodules

git clone --recurse-submodules

gfm

Fetches from and merges with another repository or local branch

git pull

gfr

Fetches from and rebases on another repository or local branch

git pull --rebase

Flow (F)

gFi

Is short for "git flow init"

git flow init

Flow Feature (Ff)

gFf

Is short for "git flow feature"

git flow feature

gFfl

Is short for "git flow feature list"

git flow feature list

gFfs

Is short for "git flow feature start"

git flow feature start

gFff

Is short for "git flow feature finish"

git flow feature finish

gFfp

Is short for "git flow feature publish"

git flow feature publish

gFft

Is short for "git flow feature track"

git flow feature track

gFfd

Is short for "git flow feature diff"

git flow feature diff

gFfr

Is short for "git flow feature rebase"

git flow feature rebase

gFfc

Is short for "git flow feature checkout"

git flow feature checkout

gFfm

Is short for "git flow feature pull"

git flow feature pull

gFfx

Is short for "git flow feature delete"

git flow feature delete

Flow Bugfix (Fb)

gFb

Is short for "git flow bugfix"

git flow bugfix

gFbl

Is short for "git flow bugfix list"

git flow bugfix list

gFbs

Is short for "git flow bugfix start"

git flow bugfix start

gFbf

Is short for "git flow bugfix finish"

git flow bugfix finish

gFbp

Is short for "git flow bugfix publish"

git flow bugfix publish

gFbt

Is short for "git flow bugfix track"

git flow bugfix track

gFbd

Is short for "git flow bugfix diff"

git flow bugfix diff

gFbr

Is short for "git flow bugfix rebase"

git flow bugfix rebase

gFbc

Is short for "git flow bugfix checkout"

git flow bugfix checkout

gFbm

Is short for "git flow bugfix pull"

git flow bugfix pull

gFbx

Is short for "git flow bugfix delete"

git flow bugfix delete

Release

gFr

Is short for "git flow release"

git flow release

gFrl

Is short for "git flow release list"

git flow release list

gFrs

Is short for "git flow release start"

git flow release start

gFrf

Is short for "git flow release finish"

git flow release finish

gFrp

Is short for "git flow release publish"

git flow release publish

gFrt

Is short for "git flow release track"

git flow release track

gFrd

Is short for "git flow release diff"

git flow release diff

gFrr

Is short for "git flow release rebase"

git flow release rebase

gFrc

Is short for "git flow release checkout"

git flow release checkout

gFrm

Is short for "git flow release pull"

git flow release pull

gFrx

Is short for "git flow release delete"

git flow release delete

Flow Hotfix (Fh)

gFh

Is short for "git flow hotfix"

git flow hotfix

gFhl

Is short for "git flow hotfix list"

git flow hotfix list

gFhs

Is short for "git flow hotfix start"

git flow hotfix start

gFhf

Is short for "git flow hotfix finish"

git flow hotfix finish

gFhp

Is short for "git flow hotfix publish"

git flow hotfix publish

gFht

Is short for "git flow hotfix track"

git flow hotfix track

gFhd

Is short for "git flow hotfix diff"

git flow hotfix diff

gFhr

Is short for "git flow hotfix rebase"

git flow hotfix rebase

gFhc

Is short for "git flow hotfix checkout"

git flow hotfix checkout

gFhm

Is short for "git flow hotfix pull"

git flow hotfix pull

gFhx

Is short for "git flow hotfix delete"

git flow hotfix delete

Flow Support (Fs)

gFs

Is short for "git flow support"

git flow support

gFsl

Is short for "git flow support list"

git flow support list

gFss

Is short for "git flow support start"

git flow support start

gFsf

Is short for "git flow support finish"

git flow support finish

gFsp

Is short for "git flow support publish"

git flow support publish

gFst

Is short for "git flow support track"

git flow support track

gFsd

Is short for "git flow support diff"

git flow support diff

gFsr

Is short for "git flow support rebase"

git flow support rebase

gFsc

Is short for "git flow support checkout"

git flow support checkout

gFsm

Is short for "git flow support pull"

git flow support pull

gFsx

Is short for "git flow support delete"

git flow support delete

Grep (g)

gg

Displays lines matching a pattern

git grep

ggi

Displays lines matching a pattern ignoring case

git grep --ignore-case

ggl

Lists files matching a pattern

git grep --files-with-matches

ggL

Lists files that are not matching a pattern

git grep --files-without-matches

ggv

Displays lines not matching a pattern

git grep --invert-match

ggw

Displays lines matching a pattern at word boundary

git grep --word-regexp

Index (i)

gia

Adds file contents to the index

git add

giA

Adds file contents to the index interactively

git add --patch

giu

Adds file contents to the index (updates only known files)

git add --update

gid

Displays changes between the index and a named commit (diff)

git diff --no-ext-diff --cached

giD

Displays changes between the index and a named commit (word diff)

git diff --no-ext-diff --cached --word-diff

gii

Temporarily ignore differences in a given file

git update-index --assume-unchanged

giI

Unignore differences in a given file

git update-index --no-assume-unchanged

gir

Resets the current HEAD to the specified state

git reset

giR

Resets the current index interactively

git reset --patch

gix

Removes files/directories from the index (recursively)

git rm -r --cached

giX

Removes files/directories from the index (recursively and forced)

git rm -rf --cached

Log (l)

gl

Displays the log

git log --topo-order --pretty=format:"${gitlogmediumformat}"

gls

Displays the stats log

git log --topo-order --stat --pretty=format:"${gitlogmediumformat}"

gld

Displays the diff log

git log --topo-order --stat --patch --full-diff --pretty=format:"${gitlogmediumformat}"

glo

Displays the one line log

git log --topo-order --pretty=format:"${gitlogonelineformat}"

glg

Displays the graph log

git log --topo-order --all --graph --pretty=format:"${gitlogonelineformat}"

glb

Displays the brief commit log

git log --topo-order --pretty=format:"${gitlogbriefformat}"

glc

Displays the commit count for each contributor in descending order

git shortlog --summary --numbered

glS

Displays the log and checks the validity of signed commits

git log --show-signature

Merge (m)

gm

Joins two or more development histories together

git merge

gmC

Joins two or more development histories together but does not commit

git merge --no-commit

gmF

Joins two or more development histories together but does not commit generating a merge commit even if the merge resolved as a fast-forward

git merge --no-ff

gma

Aborts the conflict resolution, and reconstructs the pre-merge state

git merge --abort

gmt

Runs the merge conflict resolution tools to resolve conflicts

git mergetool

Push (p)

gp

Updates remote refs along with associated objects

git push

gpf

Forcefully updates remote refs along with associated objects using the safer "--force-with-lease" option

git push --force-with-lease

gpF

Forcefully updates remote refs along with associated objects using the riskier "--force" option

git push --force

gpa

Updates remote branches along with associated objects

git push --all

gpA

Updates remote branches and tags along with associated objects

git push --all && git push --tags

gpt

Updates remote tags along with associated objects

git push --tags

gpc

Updates remote refs along with associated objects and adds origin as an upstream reference for the current branch

git push --set-upstream origin "$(git-branch-current 2> /dev/null)"

gpp

Pulls and pushes from origin to origin

git pull origin "$(git-branch-current 2> /dev/null)" && git push origin "$(git-branch-current 2> /dev/null)"

Rebase (r)

gr

Forward-ports local commits to the updated upstream head

git rebase

gra

Aborts the rebase

git rebase --abort

grc

Continues the rebase after merge conflicts are resolved

git rebase --continue

gri

Makes a list of commits to be rebased and opens the editor

git rebase --interactive

grs

Skips the current patch

git rebase --skip

Remote (R)

gR

Manages tracked repositories

git remote

gRl

Lists remote names and their URLs

git remote --verbose

gRa

Adds a new remote

git remote add

gRx

Removes a remote

git remote rm

gRm

Renames a remote

git remote rename

gRu

Fetches remotes updates

git remote update

gRp

Prunes all stale remote tracking branches

git remote prune

gRs

Displays information about a given remote

git remote show

gRb

Opens a remote on [GitHub][3] in the default browser

git-hub-browse

Stash (s)

gs

Stashes the changes of the dirty working directory

git stash

gsa

Applies the changes recorded in a stash to the working directory

git stash apply

gsx

Drops a stashed state

git stash drop

gsX

Drops all the stashed states

git-stash-clear-interactive

gsl

Lists stashed states

git stash list

gsL

Lists dropped stashed states

git-stash-dropped

gsd

Displays changes between the stash and its original parent

git stash show --patch --stat

gsp

Removes and applies a single stashed state from the stash list

git stash pop

gsr

Recovers a given stashed state

git-stash-recover

gss

Stashes the changes of the dirty working directory, including untracked

git stash save --include-untracked

gsS

Stashes the changes of the dirty working directory interactively

git stash save --patch --no-keep-index

gsw

Stashes the changes of the dirty working directory retaining the index

git stash save --include-untracked --keep-index

Submodule (S)

gS

Initializes, updates, or inspects submodules

git submodule

gSa

Adds given a repository as a submodule

git submodule add

gSf

Evaluates a shell command in each of checked out submodules

git submodule foreach

gSi

Initializes submodules

git submodule init

gSI

Initializes and clones submodules recursively

git submodule update --init --recursive

gSl

Lists the commits of all submodules

git submodule status

gSm

Moves a submodule

git-submodule-move

gSs

Synchronizes submodules remote URL to the value specified in .gitmodules

git submodule sync

gSu

Fetches and merges the latest changes for all submodule

git submodule foreach git pull origin master

gSx

Removes a submodule

git-submodule-remove

Tag (t)

gt

Lists tags or creates tag

git tag

gtl

Lists tags matching pattern

git tag -l

gts

Creates a signed tag

git tag -s

gtv

Validate a signed tag

git verify-tag

Working Directory (w)

gws

Displays working-tree status in the short format

git status --ignore-submodules=${gitstatusignoresubmodules} --short

gwS

Displays working-tree status

git status --ignore-submodules=${gitstatusignoresubmodules}

gwd

Displays changes between the working tree and the index (diff)

git diff --no-ext-diff

gwD

Displays changes between the working tree and the index (word diff)

git diff --no-ext-diff --word-diff

gwr

Resets the current HEAD to the specified state, does not touch the index nor the working tree

git reset --soft

gwR

Resets the current HEAD, index and working tree to the specified state

git reset --hard

gwc

Removes untracked files from the working tree (dry-run)

git clean -n

gwC

Removes untracked files from the working tree

git clean -f

gwx

Removes files from the working tree and from the index recursively

git rm -r

gwX

Removes files from the working tree and from the index recursively and forcefully

git rm -rf