Git

Git and GitHub CLI.

File aliases/git.sh. Disable: export ALIASX_DISABLE="git"

Status and staging

NameRunsWhat it does
ggitgit
gsgit status --short --branchshort status with branch
gstgit statusfull status
gagit addstage files
gaagit add --allstage everything
gapgit add --patchstage hunks interactively

Diff

NameRunsWhat it does
gdgit diffunstaged diff
gdsgit diff --stagedstaged diff
gdwgit diff --word-diffword-level diff

Branches

NameRunsWhat it does
gbgit branchlist branches
gbagit branch --alllist local and remote branches
gbdgit branch --deletedelete merged branch
gswgit switchswitch branch
gswcgit switch --createcreate and switch branch
gcogit checkoutcheckout
gcbgit checkout -bcreate branch via checkout

Commit

NameRunsWhat it does
gcgit commitcommit
gcmgit commit -mcommit with message
gcagit commit --amendamend last commit
gcangit commit --amend --no-editamend last commit, keep message
grsgit restorediscard file changes
grssgit restore --stagedunstage files

Remote

NameRunsWhat it does
gfgit fetchfetch
gfagit fetch --all --prunefetch all remotes, prune
gpgit pushpush
gpugit push --set-upstream origin HEADpush and set upstream
gpfgit push --force-with-leaseforce push, safe (with lease)
glgit pullpull
glrgit pull --rebasepull with rebase
gremotesgit remote --verboselist remotes with URLs

Merge and rebase

NameRunsWhat it does
gmgit mergemerge
gmagit merge --abortabort merge
grbgit rebaserebase
grbagit rebase --abortabort rebase
grbcgit rebase --continuecontinue rebase

Stash and tags

NameRunsWhat it does
gstagit stash pushstash changes
gstpgit stash popapply and drop last stash
gstlgit stash listlist stashes
gtagsgit tag --sort=-creatordatetags, newest first

Log

NameRunsWhat it does
gloggit log --oneline --decorate --graphone-line graph log
glogagit log --oneline --decorate --graph --allgraph log, all branches
glastgit log -1 HEAD --statlast commit with stats
gwhogit shortlog --summary --numberedcommits per author
grootprint repository root
example
$ groot
/home/ali/projects/shop
gundoundo last commit, keep changes staged
example
$ gundo
(last commit undone, changes stay staged)
gclean-previewshow untracked files git clean would remove
example
$ gclean-preview
Would remove build/
Would remove tmp.log
gpristinediscard all changes after typing PRISTINE
example
$ gpristine
 M api/user.go
?? tmp.log
Discard tracked changes and remove untracked files. Type PRISTINE to continue: no
Cancelled.

Work in progress

NameRunsWhat it does
gwipcommit everything as a temporary WIP commit
example
$ gwip
[main 3f1c9b2] --wip-- [skip ci]
gunwipundo the last commit if it is a WIP commit, keep changes
example
$ gunwip
undid 3f1c9b2 --wip-- [skip ci]
gfixup COMMITcommit staged changes as a fixup of COMMIT, then autosquash
example
$ gfixup 3f1c9b2
[main 9a1b2c3] fixup! add login form
Successfully rebased and updated refs/heads/main.
gclean-branchesdelete local branches already merged into the current one, after y/N
example
$ gclean-branches
feature/login
fix/typo
Delete these merged branches? [y/N] y
gbl FILE [LINE]who changed FILE (or one LINE of it), ignoring whitespace
example
$ gbl api/user.go 42
3f1c9b2 (Ali 2026-09-30 42) if err := validate(u); err != nil {

GitHub CLI

NameRunsWhat it does
ghprgh pr view --webopen PR in browserneeds gh
ghprsgh pr listlist PRsneeds gh
ghissuesgh issue listlist issuesneeds gh
ghrepogh repo view --webopen repo in browserneeds gh
ghrunsgh run listlist workflow runsneeds gh
ghwatchgh run watchwatch workflow runneeds gh