Git Complete list of all commands
Setup and Config
--local | --global | --system
[user| author].name < name>
[user| author].email < email>
init.defaultBranch < name>
init.templateDir < dir-path>
core.editor < name> (code --wait)
core.autocrlf < true| false| input>
core.symlinks < true| false>
core.abbrev < number> (show commit length)
diff.tool < name> (vscode)
difftool.< tool-name> .cmd < args>
difftool.vscode.cmd ' code --wait --diff $LOCAL $REMOTE' (for vscode)
merge.tool < name> (vscode)
mergetool.< tool-name> .cmd < args>
mergetool.vscode.cmd ' code --wait --merge $REMOTE $LOCAL $BASE $MERGED' (for vscode)
alias.< key> < value>
web.browser < name>
browser.< msedge> .cmd < msedge.exe>
column.branch < always| never>
advice.addIgnoredFile < true| false>
safe.directory < path/directory>
-e| --edit
--add
--get < option.key> (user.name)
--get-all (help)
--unset < option.key>
-v | --version
--html-path
-h | --help
help
tutorial
< option> (diff,log,...)
< option> -h | --help (web)
-i | --info
-a | --all
-g | --guides
-w | --web
-c | --config
Getting and Creating Projects
< dir-path>
-b < branch-name> | --initial-branch=< branch-name>
--template=< path/.git>
--separate-git-dir=< .git-dir>
-q | --quiet (Only print error and warning messages)
< remote-url>
< local-path>
-o < name> | --origin < name>
-b < name> | --branch < name>
--[no-]single-branch
--no-tags
-n | --no-checkout
-l | --local
-s | --shared
-q | --quiet
-v | --verbose
--sparse
--depth < number>
--template=< path/.git> (with clone url| path)
--separate-git-dir=< git-dir>
Basic Snap shotting
dir/ | file.x (all)
/dir/ | /file.x (root)
! dir/ | ! file.x (ignore)
dir/* | file.* (in all)
** /sumdir | dir/** | ** /file.x (into)
dir/** /file.* | dir/** /* .x (subdir)
[a-zA-Z0-9].x | * .[ac] | * .[cpp]* (range notation)
# (comment)
\ (Escaped Characters, example \! important! .txt)
. | * | :/ (:/ add all files with top path)
dir/ | file ...
-A | --all | --no-ignore-removal
--no-all | --ignore-removal
-v | --verbose
-p | --patch
-u | --update
-i | --interactive
-e | --edit
-f | --force
-n | --dry-run
--chmod=(+| -)x
-- < pathspec>
--long (default)
-s | --short
-v | --verbose
--[no-]ahead-behind
--[no-]renames
-u< mode> | --untracked-files=< mode> (no| normal| all)
--ignored (no| matching| traditional)
-z
? = untracked
! = ignored
A = added
C = copied
D = deleted
M = modified
R = renamed
T = typechange
U = updated
-u | -p | --patch (default)
-s | --no-patch
-U< line-number> | --unified=< line-number>
--output=< file.diff>
--output-indicator-new=< char>
--output-indicator-old=< char>
--output-indicator-context=< char>
--raw
--patch-with-raw| -p --raw
--compact-summary
--numstat
--shortstat
--summary
--stat[= width]
--patch-with-stat| -p --stat
--name-only
--name-status
--word-diff[= color| plain| porcelain| none]
--word-diff-regex=< regex>
--color-words[=< regex> ] | --word-diff=color
--check
-S< string> (change string)
-t < tool> | --tool=< tool>
--tool-help
-d | --dir-diff
-y | --[no-]prompt
--rotate-to=< file>
--skip-to=< file>
--[no-]symlinks
-x < command> | --extcmd=< command>
-g | --[no-]gui
--[no-]trust-exit-code
-m < message> | --message=< message>
-a | --all
-am | -a -m
-p | --patch
-C < commit> | --reuse-message=< commit> (with date-time)
-c < commit> | --reedit-message=< commit> (with date-time)
--amend
--reset-author (with -C| -c| --amend)
--author=" Name <mail>" (new)
--squash=< commit>
--dry-run | --long
-z | --null | --short | --porcelain
--date=< date> ([dd[/mm| Jun][[/| ]yyyy]? ]? + [hh:mm:ss? ]? )
-F < file> | --file=< file> (commit file)
-t < file> | --template=< file> (commit file with edit)
--pathspec-from-file=< file>
--allow-empty-message
--allow-empty (commit)
-u< mode> | --untracked-files=< mode> (no| normal| all)
-o | --only
-i | --include
-s | --[no-]signoff
-e | --[no-]edit
-v | --verbose
-q | --quiet
--[no-]status
--cleanup=< mode> (default| scissors| strip| verbatim| whitespace)
list
show
[add| append]
--allow-empty | -F < file> | -m < message> | -c | -C | (-f for add)
edit
--allow-empty
copy
< from-id> < to-id> | -f
get-ref
-q | --quiet
-v | --verbose
dir/ | file | * ...
-s < tree> | --source=< tree> (HEAD| branch| commit| tag)
-W | --worktree (default)
-p | --patch
-S | --staged (same as git reset)
:/ | . | * ...
dir/ | file | < tree>
-p | --patch
--pathspec-from-file=< file>
--mixed (with unstage default)
--soft (with stage)
--hard (like checkout, reset all data and files)
--merge (reset merge)
--keep (keep change worktree)
# https://stackoverflow.com/questions/24728543/git-reset-merge-vs-git-reset-keep
dir/ | file | * ...
-f | --force
-n | --dry-run
--cached
--quiet
-r (allow recursive removal)
-q | --quiet (remove files no output)
--pathspec-from-file=< file>
--ignore-unmatch
path/source path/move
-f | --force
-k (skip move files already exists)
-n | --dry-run
-v | --verbose
Branching and Merging
< name> (new branch)
-a | --all
-l | --list < pattern> (dev-* )
--create-reflog
--show-current
-v | -vv | --verbose
-q | --quiet
-f | --force
-i | --ignore-case
-d | --delete | -D (-d -f)
-m | --move | -M (-m -f) (old > new) (move or rename)
-c | --copy | -C (-c -f) (old > new)
-r | --remotes (show only remote branch)
--[no-]color
--[no-]column
--[no-]abbrev=< n> (show commit numbers length with -v)
-t | --[no-]track[= direct| inherit]? < origin/branch> (direct = track or inherit = no-track)
-u < upstream> | --set-upstream-to=< upstream> (origin/branch)
--unset-upstream
--edit-description
--[no-]contains < comment>
--[no-]merged < commit>
< tree>
-- ' *.c'
-b | -B (-b -f) < new-branch>
-f | --force
-q | --quiet
-p | --patch
-d | --detach (with commit ignore warning)
--[no-]progress
--[no-]guess
-m | --merge < file>
--conflict=< merge| diff3| zdiff3> (default merge)
--orphan < new-branch> (All tracked files are removed)
-t | --[no-]track[= direct| inherit]? < origin/branch> (direct = track or inherit = no-track) (with new branch)
--pathspec-from-file=< file> (in files path)
--ignore-other-worktrees
< tree>
-c | --create < new-branch>
-C | --force-create < new-branch>
-f | --force
-d | --detach (with commit)
--[no-]guess
-m | --merge
--conflict=< merge| diff3| zdiff3> (default merge)
--[no-]progress
-t | --[no-]track[= direct| inherit]? < origin/branch> (direct = track or inherit = no-track) (with new branch)
--orphan < new-branch> (All tracked files are removed)
--ignore-other-worktrees
< tree>
--[no-]commit (' no' do not create a merge commit)
--[no-]squash (--squash not create merge up to index state. With --squash, --commit is not allowed, and will fail.)
-e | --[no-]edit
-m < message> | --message=< message>
--cleanup=< mode> (default| scissors| strip| verbatim| whitespace)
--[no-]ff[-only] (fast-forward merge)
-F < file> | --file=< file>
--abort (only be run after the merge has resulted in conflicts)
--log=< n> | --log[-no]
--[no-]signoff (Add a Signed-off-by trailer by the committer at the end of the commit log message.)
-n | --[no-]stat (Show a diffstat at the end of the merge.)
--[no-]summary (Synonyms to --stat and --no-stat)
--[no-]verify
-s < strategy> | --strategy=< strategy>
-q | --quiet (Implies --no-progress)
-v | --verbose
--[no-]progress
--allow-unrelated-histories
--into-name < branch> (merge message as if merging to the < branch> )
--[no-]overwrite-ignore
-t < tool> | --tool=< tool> (vimdiff, vscode)
--tool-help
-y | --[no-]prompt
-g | --[no-]gui
-O< orderfile>
< commit>
[--] < path> ...
--follow < file> (works only for a single file)
--[no-]decorate[= short| full| auto| no] (auto default, no- same =no)
--decorate-refs=< pattern> (HEAD| refs/heads/| refs/remotes/| refs/stash/| refs/tags/)
-s | --source < tree>
--full-diff
-L< start-line> :< file>
-< number> | -n < number> | --max-count=< number> (commit log number)
--skip=< number> (commit log number, skip into start)
--since=< date> | --after=< date> ([dd[/mm| Jun][[/| ]yyyy]? ]? + [hh:mm:ss? ]? )
--since-as-filter=< date> ^^
--until=< date> | --before=< date>
--author=< pattern> (" Name? <email>?" )
--grep=< pattern> (message match pattern)
--[no-]merges
--tags[=< pattern> ]
--remotes[=< pattern> ]
--merge
--boundary
--cherry (only print commit messages no merge)
--reverse
--no-walk[= (sorted| unsorted)] (only print last one commit)
--pretty=< format> | --format=< format> (oneline| short| medium| full| fuller| reference| email| raw)
--[no-]abbrev-commit
--oneline
--parents
--children
--left-right
--graph
-p | -u | --patch < path> ?
-s | --no-patch
--diff-merges=< format> (off| none| on| first-parent| 1| separate| m| combined| c| dense-combined| cc| remerge| r)
--no-diff-merges | --diff-merges=(off| none)
--diff-merges | --diff-merges=(on| m)
-c | --diff-merges=combined | --diff-merges=c
--raw
--show-signature
--patch-with-raw
-t
--[no-]indent-heuristic
-z
--name-only
--name-status
--all
--not
--name-only (files name)
--name-status (files name)
--[no-]color[=< when> ] (always| never| auto)
--word-diff[=< mode> ] (color| plain| porcelain| none)
--color-words
--no-renames
--check
--[no-]rename-empty
--output=< file>
--minimal
< tree>
--pretty[=< format> ] | --format[=< format> ] (oneline| short| medium| full| fuller| reference| email| raw)
--[no-]abbrev-commit
--oneline | --pretty=oneline
-p | -u | --patch < path> ?
-s | --no-patch
--diff-merges=(off| none| on| first-parent| 1| separate| m| combined| c| dense-combined| cc| remerge| r)
--no-diff-merges | --diff-merges=(off| none)
--diff-merges | --diff-merges=(on| m)
--output=< file>
--minimal
--all
--single-worktree
--expire=< time>
--expire-unreachable=< time>
--updateref
--rewrite
--stale-fix
-n | --dry-run
--verbose
< options>
[--] dir/ | file | * ... (-- for stash)
-a | --all
-u | --[no-]include-untracked
-k | --[no-]keep-index
-S | --staged
-m | --message < message>
-q | --quiet
-p | --patch
--pathspec-from-file=< file>
push | ! save < options>
list
-p | --patch
show
' stash@{n}' (default 0)
-p | --patch
-u | --[no-]include-untracked | --only-untracked
pop | apply (apply keep stash)
' stash@{n}'
-a | --all
-q | --quiet
--index < number>
branch
< new-branch> ' stash@{n}'
drop (remove stash frome list)
' stash@{n}'
-q | --quiet
create
< message>
store < commit> (create commit id)
clear
< version> (v1.0.0)
-a | --annotate
-m | --messag < message>
-am (annotate and message)
-l | --list < v-* > ?
-d | --delete < tag>
-f | --force
-e | --edit
-F | --file < file>
--[no-]column
-n< number> (with --list)
--cleanup=< mode> (strip| verbatim| whitespace)
-i | --ignore-case (with --list)
--[no-]contains
add
< path>
-b < new-branch> | -B < new-branch> (-B branch already exists)
-d < tree> | --detach < tree>
--track < remote> /< branch>
-f | --force
--[no-]checkout
--lock
list
-v | --verbose
--porcelain
lock
< worktree>
--reason=< message>
unlock
< worktree>
move
< worktree> < new-path>
prune
-n | --dry-run
-v | --verbose
repair
< path> ...
remove
< worktree> (tree directory name)
-f | --force
Sharing and Updating Projects
--all
-a | --append
--atomic
--depth=< depth>
--deepen=< depth>
--shallow-since=< date>
--shallow-exclude=< revision>
--unshallow
--update-shallow
--negotiation-tip=< commit| glob>
--negotiate-only
--dry-run
--[no-]write-fetch-head
-f | --force
-k | --keep
--multiple
--[no-]auto-maintenance
--[no-]auto-gc
--[no-]write-commit-graph
--prefetch
-p | --prune
-P | --prune-tags
-n | --no-tags
--refetch
--refmap=< refspec>
-t | --tags
--recurse-submodules[= yes| on-demand| no]
-j | --jobs=< n>
--no-recurse-submodules
--set-upstream
-u | --update-head-ok
--upload-pack < upload-pack>
-q | --quiet
-v | --verbose
-o < option> | --server-option=< option>
--show-forced-updates
--no-show-forced-updates
-q | --quiet
-v | --verbose
--[no-]recurse-submodules[= yes| on-demand| no]
--commit | --no-commit
-e | --[no-]edit
--cleanup=< mode> (default| scissors| strip| verbatim| whitespace)
-ff-only
--[no-]ff
-S[< keyid> ] | --[no-]gpg-sign[=< keyid> ]
--[no-]log[=< n> ]
--[no-]signoff
-n | [--no-]stat
--[no-]squash
--[no-]verify
-s < strategy> | --strategy=< strategy>
-X < option> | --strategy-option=< option>
--[no-]verify-signatures
--[no-]summary
--[no-]autostash
--allow-unrelated-histories
-r | --rebase[= false| true| merges| interactive]
< fetching Options>
--all
--prune
--mirror
-n | --dry-run
--porcelain
-d | --delete
--tags
--follow-tags
--[no-]signed=(true| false| if-asked)
--[no-]atomic
-o < option> | --push-option=< option>
--receive-pack=< git-receive-pack>
--exec=< git-receive-pack>
--[no-]force-with-lease
--force-with-lease=< refname>
--force-with-lease=< refname> :< expect>
-f | --force
-u | --set-upstream
--[no-]thin
-q | --quiet
-v | --verbose
--progress
--no-recurse-submodules
--recurse-submodules=check| on-demand| only| no
--[no-]verify
-v | --verbose
add origin < url>
rename < old> < new>
rm | remove < name>
set-head < name> (-a| --auto | -d| --delete | < branch> )
set-branches --add < name> < branch>
get-url [--push] [--all] < name>
show -n
prune < name> --dry-run
update remotes.< group>
Inspection and Comparison
Patching