2015-12-15 00:12:17 -05:00
|
|
|
#
|
2015-12-20 20:41:54 -05:00
|
|
|
# Git aliases.
|
2015-12-15 00:12:17 -05:00
|
|
|
#
|
|
|
|
|
2015-12-20 20:41:54 -05:00
|
|
|
#
|
|
|
|
# Settings
|
|
|
|
#
|
|
|
|
|
2017-12-01 17:23:34 -05:00
|
|
|
# Log colour scheme has yellow commit hash, bold blue author, cyan date, auto ref names
|
2017-11-24 17:02:29 -05:00
|
|
|
# See https://git-scm.com/docs/pretty-formats
|
2017-12-01 17:23:34 -05:00
|
|
|
_git_log_medium_format='%C(bold)Commit:%C(reset) %C(yellow)%H%C(auto)%d%n%C(bold)Author:%C(reset) %C(bold blue)%an <%ae>%n%C(bold)Date:%C(reset) %C(cyan)%ai (%ar)%C(reset)%n%+B'
|
2018-01-10 10:25:25 -05:00
|
|
|
_git_log_oneline_format='%C(yellow)%h%C(reset) %s%C(auto)%d%C(reset)'
|
2018-01-13 17:56:20 -05:00
|
|
|
_git_log_oneline_medium_format='%C(yellow)%h%C(reset) %<|(60,trunc)%s %C(bold blue)<%an> %C(reset)%C(cyan)(%ar)%C(auto)%d%C(reset)'
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
#
|
|
|
|
# Aliases
|
|
|
|
#
|
|
|
|
|
|
|
|
# Git
|
|
|
|
alias g='git'
|
|
|
|
|
|
|
|
# Branch (b)
|
|
|
|
alias gb='git branch'
|
|
|
|
alias gbc='git checkout -b'
|
2018-01-22 17:25:51 -05:00
|
|
|
alias gbl='git branch -vv'
|
|
|
|
alias gbL='git branch --all -vv'
|
2017-07-24 18:10:10 -04:00
|
|
|
alias gbm='git branch --move'
|
|
|
|
alias gbM='git branch --move --force'
|
2015-12-20 20:41:54 -05:00
|
|
|
alias gbs='git show-branch'
|
2017-07-24 18:10:10 -04:00
|
|
|
alias gbS='git show-branch --all'
|
2018-02-05 10:44:59 -05:00
|
|
|
alias gbx='git-branch-delete-interactive'
|
|
|
|
alias gbX='git-branch-delete-interactive --force'
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
# Commit (c)
|
|
|
|
alias gc='git commit --verbose'
|
|
|
|
alias gca='git commit --verbose --all'
|
|
|
|
alias gcm='git commit --message'
|
|
|
|
alias gco='git checkout'
|
|
|
|
alias gcO='git checkout --patch'
|
|
|
|
alias gcf='git commit --amend --reuse-message HEAD'
|
|
|
|
alias gcF='git commit --verbose --amend'
|
|
|
|
alias gcp='git cherry-pick --ff'
|
|
|
|
alias gcP='git cherry-pick --no-commit'
|
|
|
|
alias gcr='git revert'
|
|
|
|
alias gcR='git reset "HEAD^"'
|
[git] Review aliases and README.md
This complements the changes done in the last commit, and also fixes the
`glg` output, and removes the now unnecessary `--date=relative`
parameter from `glG`.
Although I insisted on the `--long-option` format on 8669a4f, I think
`rm -rf` is pretty common and recognizable, so revert to that.
Add missing aliases to README.md, and improve description of existing
ones. The main improvement is trying to be more concise, so instead of
repeating "records changes to the repository" multiple times, simply say
"commits", for example. Also try to use words that match the alias
letters, so for "gcs" say "shows" instead of "displays", for example.
2018-01-11 11:30:20 -05:00
|
|
|
alias gcs='git show --pretty=format:"${_git_log_medium_format}"'
|
2015-12-20 20:41:54 -05:00
|
|
|
alias gcS='git commit -S'
|
[git] Breaking changes in aliases and functions
Rename `gpS` (mnemonic "pretty-signature") and `glS` ("log-signature")
to `gcv` ("commit-verify") and `glv` ("log-verify") respectivelly,
so `v` is used to verify signatures, and `s`/`S` is used to sign.
Remove `git-commit-lost` and `git-stash-dropped`, as this could be
probably joined into one function that shows all lost commits, including
lost stashes, and also because there seems to be many different ways to
do this, as discussed in https://stackoverflow.com/q/89332/2654518.
An answer worth noting is https://stackoverflow.com/a/6455586/2654518.
If someone is using this, let's discuss on a new solution...
Remove Oh-My-Zsh compatibility from `git-branch-current`, and delete
`git_current_branch`. This compatibility was already partially broken at
c1b02c0, when we also updated the gitster prompt theme. Now this
function fails when in 'detached HEAD' state (is was returning the
commit hash in this state), which is what we would expect from the use
we make of it.
Closes #244
2018-01-11 16:00:05 -05:00
|
|
|
alias gcv='git verify-commit'
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
# Conflict (C)
|
2018-02-15 12:44:13 -05:00
|
|
|
alias gCl='git --no-pager diff --diff-filter=U --name-only'
|
2015-12-20 20:41:54 -05:00
|
|
|
alias gCa='git add $(gCl)'
|
|
|
|
alias gCe='git mergetool $(gCl)'
|
|
|
|
alias gCo='git checkout --ours --'
|
|
|
|
alias gCO='gCo $(gCl)'
|
|
|
|
alias gCt='git checkout --theirs --'
|
|
|
|
alias gCT='gCt $(gCl)'
|
|
|
|
|
|
|
|
# Data (d)
|
|
|
|
alias gd='git ls-files'
|
|
|
|
alias gdc='git ls-files --cached'
|
|
|
|
alias gdx='git ls-files --deleted'
|
|
|
|
alias gdm='git ls-files --modified'
|
|
|
|
alias gdu='git ls-files --other --exclude-standard'
|
|
|
|
alias gdk='git ls-files --killed'
|
|
|
|
alias gdi='git status --porcelain --short --ignored | sed -n "s/^!! //p"'
|
|
|
|
|
|
|
|
# Fetch (f)
|
|
|
|
alias gf='git fetch'
|
|
|
|
alias gfc='git clone'
|
|
|
|
alias gfm='git pull'
|
|
|
|
alias gfr='git pull --rebase'
|
2017-07-25 09:28:42 -04:00
|
|
|
alias gfu='git fetch --all --prune && git merge --ff-only @\{u\}'
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
# Grep (g)
|
|
|
|
alias gg='git grep'
|
|
|
|
alias ggi='git grep --ignore-case'
|
|
|
|
alias ggl='git grep --files-with-matches'
|
2016-09-28 07:32:17 -04:00
|
|
|
alias ggL='git grep --files-without-match'
|
2015-12-20 20:41:54 -05:00
|
|
|
alias ggv='git grep --invert-match'
|
|
|
|
alias ggw='git grep --word-regexp'
|
|
|
|
|
|
|
|
# Index (i)
|
|
|
|
alias gia='git add'
|
|
|
|
alias giA='git add --patch'
|
|
|
|
alias giu='git add --update'
|
|
|
|
alias gid='git diff --no-ext-diff --cached'
|
|
|
|
alias giD='git diff --no-ext-diff --cached --word-diff'
|
|
|
|
alias gir='git reset'
|
|
|
|
alias giR='git reset --patch'
|
[git] Review aliases and README.md
This complements the changes done in the last commit, and also fixes the
`glg` output, and removes the now unnecessary `--date=relative`
parameter from `glG`.
Although I insisted on the `--long-option` format on 8669a4f, I think
`rm -rf` is pretty common and recognizable, so revert to that.
Add missing aliases to README.md, and improve description of existing
ones. The main improvement is trying to be more concise, so instead of
repeating "records changes to the repository" multiple times, simply say
"commits", for example. Also try to use words that match the alias
letters, so for "gcs" say "shows" instead of "displays", for example.
2018-01-11 11:30:20 -05:00
|
|
|
alias gix='git rm --cached -r'
|
|
|
|
alias giX='git rm --cached -rf'
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
# Log (l)
|
|
|
|
alias gl='git log --topo-order --pretty=format:"${_git_log_medium_format}"'
|
|
|
|
alias gls='git log --topo-order --stat --pretty=format:"${_git_log_medium_format}"'
|
|
|
|
alias gld='git log --topo-order --stat --patch --full-diff --pretty=format:"${_git_log_medium_format}"'
|
|
|
|
alias glo='git log --topo-order --pretty=format:"${_git_log_oneline_format}"'
|
2018-01-13 17:56:20 -05:00
|
|
|
alias glO='git log --topo-order --pretty=format:"${_git_log_oneline_medium_format}"'
|
2018-04-09 13:07:37 -04:00
|
|
|
alias glg='git log --topo-order --all --graph --pretty=format:"${_git_log_oneline_format}"'
|
|
|
|
alias glG='git log --topo-order --all --graph --pretty=format:"${_git_log_oneline_medium_format}"'
|
[git] Breaking changes in aliases and functions
Rename `gpS` (mnemonic "pretty-signature") and `glS` ("log-signature")
to `gcv` ("commit-verify") and `glv` ("log-verify") respectivelly,
so `v` is used to verify signatures, and `s`/`S` is used to sign.
Remove `git-commit-lost` and `git-stash-dropped`, as this could be
probably joined into one function that shows all lost commits, including
lost stashes, and also because there seems to be many different ways to
do this, as discussed in https://stackoverflow.com/q/89332/2654518.
An answer worth noting is https://stackoverflow.com/a/6455586/2654518.
If someone is using this, let's discuss on a new solution...
Remove Oh-My-Zsh compatibility from `git-branch-current`, and delete
`git_current_branch`. This compatibility was already partially broken at
c1b02c0, when we also updated the gitster prompt theme. Now this
function fails when in 'detached HEAD' state (is was returning the
commit hash in this state), which is what we would expect from the use
we make of it.
Closes #244
2018-01-11 16:00:05 -05:00
|
|
|
alias glv='git log --topo-order --show-signature --pretty=format:"${_git_log_medium_format}"'
|
2018-01-13 17:56:20 -05:00
|
|
|
alias glc='git shortlog --summary --numbered'
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
# Merge (m)
|
|
|
|
alias gm='git merge'
|
|
|
|
alias gmC='git merge --no-commit'
|
|
|
|
alias gmF='git merge --no-ff'
|
|
|
|
alias gma='git merge --abort'
|
|
|
|
alias gmt='git mergetool'
|
|
|
|
|
|
|
|
# Push (p)
|
|
|
|
alias gp='git push'
|
2018-10-18 12:55:30 -04:00
|
|
|
alias gpf='git push --force-with-lease'
|
|
|
|
alias gpF='git push --force'
|
2015-12-20 20:41:54 -05:00
|
|
|
alias gpa='git push --all'
|
|
|
|
alias gpA='git push --all && git push --tags'
|
|
|
|
alias gpt='git push --tags'
|
|
|
|
alias gpc='git push --set-upstream origin "$(git-branch-current 2> /dev/null)"'
|
|
|
|
alias gpp='git pull origin "$(git-branch-current 2> /dev/null)" && git push origin "$(git-branch-current 2> /dev/null)"'
|
|
|
|
|
|
|
|
# Rebase (r)
|
|
|
|
alias gr='git rebase'
|
|
|
|
alias gra='git rebase --abort'
|
2016-05-05 06:03:35 -04:00
|
|
|
alias grc='git rebase --continue'
|
2015-12-20 20:41:54 -05:00
|
|
|
alias gri='git rebase --interactive'
|
|
|
|
alias grs='git rebase --skip'
|
|
|
|
|
|
|
|
# Remote (R)
|
|
|
|
alias gR='git remote'
|
|
|
|
alias gRl='git remote --verbose'
|
|
|
|
alias gRa='git remote add'
|
|
|
|
alias gRx='git remote rm'
|
|
|
|
alias gRm='git remote rename'
|
|
|
|
alias gRu='git remote update'
|
|
|
|
alias gRp='git remote prune'
|
|
|
|
alias gRs='git remote show'
|
|
|
|
|
|
|
|
# Stash (s)
|
|
|
|
alias gs='git stash'
|
|
|
|
alias gsa='git stash apply'
|
|
|
|
alias gsx='git stash drop'
|
|
|
|
alias gsX='git-stash-clear-interactive'
|
|
|
|
alias gsl='git stash list'
|
|
|
|
alias gsd='git stash show --patch --stat'
|
|
|
|
alias gsp='git stash pop'
|
|
|
|
alias gsr='git-stash-recover'
|
|
|
|
alias gss='git stash save --include-untracked'
|
|
|
|
alias gsS='git stash save --patch --no-keep-index'
|
|
|
|
alias gsw='git stash save --include-untracked --keep-index'
|
2017-07-24 18:10:10 -04:00
|
|
|
alias gsu='git stash show --patch | git apply --reverse'
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
# Submodule (S)
|
|
|
|
alias gS='git submodule'
|
|
|
|
alias gSa='git submodule add'
|
|
|
|
alias gSf='git submodule foreach'
|
|
|
|
alias gSi='git submodule init'
|
|
|
|
alias gSI='git submodule update --init --recursive'
|
|
|
|
alias gSl='git submodule status'
|
|
|
|
alias gSm='git-submodule-move'
|
|
|
|
alias gSs='git submodule sync'
|
|
|
|
alias gSu='git submodule foreach git pull origin master'
|
|
|
|
alias gSx='git-submodule-remove'
|
|
|
|
|
|
|
|
# Tag (t)
|
[git] Review aliases and README.md
This complements the changes done in the last commit, and also fixes the
`glg` output, and removes the now unnecessary `--date=relative`
parameter from `glG`.
Although I insisted on the `--long-option` format on 8669a4f, I think
`rm -rf` is pretty common and recognizable, so revert to that.
Add missing aliases to README.md, and improve description of existing
ones. The main improvement is trying to be more concise, so instead of
repeating "records changes to the repository" multiple times, simply say
"commits", for example. Also try to use words that match the alias
letters, so for "gcs" say "shows" instead of "displays", for example.
2018-01-11 11:30:20 -05:00
|
|
|
alias gt='git tag'
|
2017-07-24 18:10:10 -04:00
|
|
|
alias gts='git tag --sign'
|
2015-12-20 20:41:54 -05:00
|
|
|
alias gtv='git verify-tag'
|
[git] Review aliases and README.md
This complements the changes done in the last commit, and also fixes the
`glg` output, and removes the now unnecessary `--date=relative`
parameter from `glG`.
Although I insisted on the `--long-option` format on 8669a4f, I think
`rm -rf` is pretty common and recognizable, so revert to that.
Add missing aliases to README.md, and improve description of existing
ones. The main improvement is trying to be more concise, so instead of
repeating "records changes to the repository" multiple times, simply say
"commits", for example. Also try to use words that match the alias
letters, so for "gcs" say "shows" instead of "displays", for example.
2018-01-11 11:30:20 -05:00
|
|
|
alias gtx='git tag --delete'
|
2015-12-20 20:41:54 -05:00
|
|
|
|
[git] Review aliases and README.md
This complements the changes done in the last commit, and also fixes the
`glg` output, and removes the now unnecessary `--date=relative`
parameter from `glG`.
Although I insisted on the `--long-option` format on 8669a4f, I think
`rm -rf` is pretty common and recognizable, so revert to that.
Add missing aliases to README.md, and improve description of existing
ones. The main improvement is trying to be more concise, so instead of
repeating "records changes to the repository" multiple times, simply say
"commits", for example. Also try to use words that match the alias
letters, so for "gcs" say "shows" instead of "displays", for example.
2018-01-11 11:30:20 -05:00
|
|
|
# Working tree (w)
|
2015-12-20 20:41:54 -05:00
|
|
|
alias gws='git status --short'
|
|
|
|
alias gwS='git status'
|
|
|
|
alias gwd='git diff --no-ext-diff'
|
|
|
|
alias gwD='git diff --no-ext-diff --word-diff'
|
|
|
|
alias gwr='git reset --soft'
|
|
|
|
alias gwR='git reset --hard'
|
2017-07-24 18:10:10 -04:00
|
|
|
alias gwc='git clean --dry-run'
|
|
|
|
alias gwC='git clean -d --force'
|
2015-12-20 20:41:54 -05:00
|
|
|
alias gwx='git rm -r'
|
[git] Review aliases and README.md
This complements the changes done in the last commit, and also fixes the
`glg` output, and removes the now unnecessary `--date=relative`
parameter from `glG`.
Although I insisted on the `--long-option` format on 8669a4f, I think
`rm -rf` is pretty common and recognizable, so revert to that.
Add missing aliases to README.md, and improve description of existing
ones. The main improvement is trying to be more concise, so instead of
repeating "records changes to the repository" multiple times, simply say
"commits", for example. Also try to use words that match the alias
letters, so for "gcs" say "shows" instead of "displays", for example.
2018-01-11 11:30:20 -05:00
|
|
|
alias gwX='git rm -rf'
|
2015-12-15 00:12:17 -05:00
|
|
|
|
2015-12-20 20:41:54 -05:00
|
|
|
# Misc
|
2018-01-10 10:25:25 -05:00
|
|
|
alias g..='cd "$(git-root || print .)"'
|