1
0
Fork 0

Add some new git aliases, modify a few more. (#1301)

* Add some new git aliases, modify a few more.
* Add `gbV` command to show more verbose git branch info.
* Add `gcam` to make it possible to execute `gca; gcm '<your message
  here>'` more simply.
* Add `gii` command to temporarily untrack (ignore) a file.
* Add `giI` command to uningore a file.
* Change alias of `gbl` to `gbv`. Personally, I think aliases that
  include a switch in the command should include the switch in the alias
  if possible.  This makes them easier to remember.
* Change alias of `gbL` to `gba`. I think the `-a` switch is more
  salient to what this alias does than the `-v`.  Furthermore, with this
  PR there are already `gbv` and `gbV` aliases, so those are out.
* Change implementation of `gCl` alias to use built-in capabilities of
  git, rather than sed.
* Rename gbx and gbX to gbd and gbD respectively
* Mostly revert alias changes
* Add gbr and gbR aliases to gbm and gbM commands
pull/930/merge
Kyle Rich 8 years ago committed by Kaleb Elwert
parent 1050a0a290
commit 3d7a8c2870

@ -41,15 +41,16 @@ Aliases are enabled by default. You can disable them with:
- `gb` lists, creates, renames, and deletes branches. - `gb` lists, creates, renames, and deletes branches.
- `gbc` creates a new branch. - `gbc` creates a new branch.
- `gbl` lists branches and their commits. - `gbl` lists branches and their commits. (also `gbv`)
- `gbL` lists local and remote branches and their commits. - `gbL` lists all local and remote branches and their commits.
- `gbm` renames a branch.
- `gbM` renames a branch even if the new branch name already exists.
- `gbs` lists branches and their commits with ancestry graphs. - `gbs` lists branches and their commits with ancestry graphs.
- `gbS` lists local and remote branches and their commits with ancestry - `gbS` lists local and remote branches and their commits with ancestry
graphs. graphs.
- `gbx` deletes a branch. - `gbV` lists branches with more verbose information about their commits.
- `gbX` deletes a branch irrespective of its merged status. - `gbx` deletes a branch. (also `gbd`)
- `gbm` renames a branch. - `gbX` deletes a branch irrespective of its merged status. (also `gbD`)
- `gbM` renames a branch even if the new branch name already exists.
### Commit ### Commit
@ -57,6 +58,7 @@ Aliases are enabled by default. You can disable them with:
- `gc` records changes to the repository. - `gc` records changes to the repository.
- `gca` stages all modified and deleted files. - `gca` stages all modified and deleted files.
- `gcm` records changes to the repository with the given message. - `gcm` records changes to the repository with the given message.
- `gcam` stages all modified and deleted files, and records changes to the repository with the given message.
- `gco` checks out a branch or paths to work tree. - `gco` checks out a branch or paths to work tree.
- `gcO` checks out hunks from the index or the tree interactively. - `gcO` checks out hunks from the index or the tree interactively.
- `gcf` amends the tip of the current branch using the same log message as - `gcf` amends the tip of the current branch using the same log message as
@ -188,6 +190,8 @@ Aliases are enabled by default. You can disable them with:
- `giu` adds file contents to the index (updates only known files). - `giu` adds file contents to the index (updates only known files).
- `gid` displays changes between the index and a named commit (diff). - `gid` displays changes between the index and a named commit (diff).
- `giD` displays changes between the index and a named commit (word diff). - `giD` displays changes between the index and a named commit (word diff).
- `gii` temporarily ignore differences in a given file.
- `giI` unignore differences in a given file.
- `gir` resets the current HEAD to the specified state. - `gir` resets the current HEAD to the specified state.
- `giR` resets the current index interactively. - `giR` resets the current index interactively.
- `gix` removes files/directories from the index (recursively). - `gix` removes files/directories from the index (recursively).

@ -32,20 +32,28 @@ if ! zstyle -t ':prezto:module:git:alias' skip 'yes'; then
# Branch (b) # Branch (b)
alias gb='git branch' alias gb='git branch'
alias gba='git branch --all --verbose'
alias gbc='git checkout -b' alias gbc='git checkout -b'
alias gbl='git branch -v' alias gbd='git branch --delete'
alias gbL='git branch -av' alias gbD='git branch --delete --force'
alias gbx='git branch -d' alias gbl='git branch --verbose'
alias gbX='git branch -D' alias gbL='git branch --all --verbose'
alias gbm='git branch -m' alias gbm='git branch --move'
alias gbM='git branch -M' alias gbM='git branch --move --force'
alias gbr='git branch --move'
alias gbR='git branch --move --force'
alias gbs='git show-branch' alias gbs='git show-branch'
alias gbS='git show-branch -a' alias gbS='git show-branch --all'
alias gbv='git branch --verbose'
alias gbV='git branch --verbose --verbose'
alias gbx='git branch --delete'
alias gbX='git branch --delete --force'
# Commit (c) # Commit (c)
alias gc='git commit --verbose' alias gc='git commit --verbose'
alias gca='git commit --verbose --all' alias gca='git commit --verbose --all'
alias gcm='git commit --message' alias gcm='git commit --message'
alias gcam='git commit --all --message'
alias gco='git checkout' alias gco='git checkout'
alias gcO='git checkout --patch' alias gcO='git checkout --patch'
alias gcf='git commit --amend --reuse-message HEAD' alias gcf='git commit --amend --reuse-message HEAD'
@ -58,7 +66,7 @@ if ! zstyle -t ':prezto:module:git:alias' skip 'yes'; then
alias gcl='git-commit-lost' alias gcl='git-commit-lost'
# Conflict (C) # Conflict (C)
alias gCl='git status | sed -n "s/^.*both [a-z]*ed: *//p"' alias gCl='git --no-pager diff --name-only --diff-filter=U'
alias gCa='git add $(gCl)' alias gCa='git add $(gCl)'
alias gCe='git mergetool $(gCl)' alias gCe='git mergetool $(gCl)'
alias gCo='git checkout --ours --' alias gCo='git checkout --ours --'
@ -159,6 +167,8 @@ if ! zstyle -t ':prezto:module:git:alias' skip 'yes'; then
alias giu='git add --update' alias giu='git add --update'
alias gid='git diff --no-ext-diff --cached' alias gid='git diff --no-ext-diff --cached'
alias giD='git diff --no-ext-diff --cached --word-diff' alias giD='git diff --no-ext-diff --cached --word-diff'
alias gii='git update-index --assume-unchanged'
alias giI='git update-index --no-assume-unchanged'
alias gir='git reset' alias gir='git reset'
alias giR='git reset --patch' alias giR='git reset --patch'
alias gix='git rm -r --cached' alias gix='git rm -r --cached'

Loading…
Cancel
Save