@ -3,34 +3,42 @@
Enhances the [Git][1] distributed version control system by providing aliases,
Enhances the [Git][1] distributed version control system by providing aliases,
functions and by exposing repository status information to prompts.
functions and by exposing repository status information to prompts.
Git **1.7.2** is the [minimum required version][7].
This module must be loaded _before_ the [_`completion`_][13] module so that the
provided completion definitions are loaded automatically by _`completion`_
module.
**Note:** Git **1.7.2** is the [minimum required version][7].
## Settings
## Settings
### Log
### Log
The format of the [git-log][8] output is configurable via the following style,
To configure the format of the [git-log][8] output, add the following to
where context is *brief* , *oneline* , and *medium* , which will be passed to the
_`${ZDOTDIR:-$HOME}/.zpreztorc`_, and replace `'<context>'` with `'brief'` ,
`--pretty=format:` switch.
`'oneline'` , and `'medium'` . This will be passed to the `--pretty=format:`
switch.
```sh
```sh
zstyle ':prezto:module:git:log:context' format ''
zstyle ':prezto:module:git:log:context' format '< context > '
```
```
### Status
### Status
Retrieving the status of a repository with submodules can take a long time.
Retrieving the status of a repository with [git-submodule][9] can take a long
Submodules may be ignored when they are *dirty* , *untracked* , *all* , or *none* .
time. To configure the submodules to ignore, add the following to
_`${ZDOTDIR:-$HOME}/.zpreztorc`_, and replace `'<state>'` with `'dirty'` ,
`'untracked'` , `'all'` , or `'none'` .
```sh
```sh
zstyle ':prezto:module:git:status:ignore' submodules 'all '
zstyle ':prezto:module:git:status:ignore' submodules '< state > '
```
```
This setting affects all aliases and functions that call `git-status` .
This setting affects all aliases and functions that call `git-status` .
## Aliases
## Aliases
Aliases are enabled by default. You can disable them with:
Aliases are enabled by default. To disable them, add the following to
_`${ZDOTDIR:-$HOME}/.zpreztorc`_.
```sh
```sh
zstyle ':prezto:module:git:alias' skip 'yes'
zstyle ':prezto:module:git:alias' skip 'yes'
@ -68,15 +76,15 @@ zstyle ':prezto:module:git:alias' skip 'yes'
- `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
*HEAD* .
_HEAD_ .
- `gcSf` amends the tip of the current branch using the same log message as
- `gcSf` amends the tip of the current branch using the same log message as
*HEAD* . (Signed)
_HEAD_ . (Signed)
- `gcF` amends the tip of the current branch.
- `gcF` amends the tip of the current branch.
- `gcSF` amends the tip of the current branch. (Signed)
- `gcSF` amends the tip of the current branch. (Signed)
- `gcp` applies changes introduced by existing commits.
- `gcp` applies changes introduced by existing commits.
- `gcP` applies changes introduced by existing commits without committing.
- `gcP` applies changes introduced by existing commits without committing.
- `gcr` reverts existing commits by reverting patches and recording new commits.
- `gcr` reverts existing commits by reverting patches and recording new commits.
- `gcR` removes the *HEAD* commit.
- `gcR` removes the _HEAD_ commit.
- `gcs` displays various types of objects.
- `gcs` displays various types of objects.
- `gcsS` displays commits with GPG signature.
- `gcsS` displays commits with GPG signature.
- `gcl` lists lost commits.
- `gcl` lists lost commits.
@ -239,13 +247,13 @@ zstyle ':prezto:module:git:alias' skip 'yes'
- `gpa` updates remote branches along with associated objects.
- `gpa` updates remote branches along with associated objects.
- `gpA` updates remote branches and tags along with associated objects.
- `gpA` updates remote branches and tags along with associated objects.
- `gpt` updates remote tags along with associated objects.
- `gpt` updates remote tags along with associated objects.
- `gpc` updates remote refs along with associated objects and adds *origin* as
- `gpc` updates remote refs along with associated objects and adds _origin_ as
an upstream reference for the current branch.
an upstream reference for the current branch.
- `gpp` pulls and pushes from origin to origin.
- `gpp` pulls and pushes from origin to origin.
### Rebase (r)
### Rebase (r)
- `gr` forward-ports local commits to the updated upstream head .
- `gr` forward-ports local commits to the updated upstream _HEAD_ .
- `gra` aborts the rebase.
- `gra` aborts the rebase.
- `grc` continues the rebase after merge conflicts are resolved.
- `grc` continues the rebase after merge conflicts are resolved.
- `gri` makes a list of commits to be rebased and opens the editor.
- `gri` makes a list of commits to be rebased and opens the editor.
@ -288,7 +296,7 @@ zstyle ':prezto:module:git:alias' skip 'yes'
- `gSl` lists the commits of all submodules.
- `gSl` lists the commits of all submodules.
- `gSm` moves a submodule.
- `gSm` moves a submodule.
- `gSs` synchronizes submodules' remote URL to the value specified in
- `gSs` synchronizes submodules' remote URL to the value specified in
*.gitmodules* .
_.gitmodules_ .
- `gSu` fetches and merges the latest changes for all submodule.
- `gSu` fetches and merges the latest changes for all submodule.
- `gSx` removes a submodule.
- `gSx` removes a submodule.
@ -318,7 +326,7 @@ zstyle ':prezto:module:git:alias' skip 'yes'
The following aliases may shadow system commands:
The following aliases may shadow system commands:
- `gb` shadows the [GB][9 ].
- `gb` shadows the [GB][10 ].
- `gm` shadows the [GraphicsMagick image processor][11].
- `gm` shadows the [GraphicsMagick image processor][11].
- `gpt` shadows the [GUID partition table maintenance utility][4].
- `gpt` shadows the [GUID partition table maintenance utility][4].
- `gs` shadows the [Ghostscript interpreter and previewer][5].
- `gs` shadows the [Ghostscript interpreter and previewer][5].
@ -335,7 +343,7 @@ You can temporarily bypass an alias by prefixing it with a backward slash:
- `git-commit-lost` lists lost commits.
- `git-commit-lost` lists lost commits.
- `git-dir` displays the path to the Git directory.
- `git-dir` displays the path to the Git directory.
- `git-hub-browse` opens the [GitHub][3] repository in the default browser.
- `git-hub-browse` opens the [GitHub][3] repository in the default browser.
- `git-hub-shorten-url` shortens [GitHub URLs][10 ].
- `git-hub-shorten-url` shortens [GitHub URLs][12 ].
- `git-info` exposes repository information via the `$git_info` associative
- `git-info` exposes repository information via the `$git_info` associative
array.
array.
- `git-root` displays the path to the working tree root.
- `git-root` displays the path to the working tree root.
@ -357,26 +365,26 @@ zstyle ':prezto:module:git:info:context:subcontext' format 'string'
### Main Contexts
### Main Contexts
| Name | Format Code | Description
| Name | Format Code | Description |
| --------- | :---------: | ----------------------------------------------------
| -------- | :---------: | ---------------------------------- |
| action | %s | Special action name
| action | %s | Special action name |
| ahead | %A | Commits ahead of remote count
| ahead | %A | Commits ahead of remote count |
| behind | %B | Commits behind of remote count
| behind | %B | Commits behind of remote count |
| branch | %b | Branch name
| branch | %b | Branch name |
| commit | %c | Commit hash
| commit | %c | Commit hash |
| position | %p | Commits from the nearest tag count
| position | %p | Commits from the nearest tag count |
| remote | %R | Remote name
| remote | %R | Remote name |
| stashed | %S | Stashed states count
| stashed | %S | Stashed states count |
### Concise Contexts
### Concise Contexts
| Name | Format Code | Description
| Name | Format Code | Description |
| --------- | :---------: | ----------------------------------------------------
| --------- | :---------: | --------------------- |
| clean | %C | Clean state
| clean | %C | Clean state |
| dirty | %D | Dirty files count
| dirty | %D | Dirty files count |
| indexed | %i | Indexed files count
| indexed | %i | Indexed files count |
| unindexed | %I | Unindexed files count
| unindexed | %I | Unindexed files count |
| untracked | %u | Untracked files count
| untracked | %u | Untracked files count |
The following contexts must be enabled with the following zstyle:
The following contexts must be enabled with the following zstyle:
@ -386,31 +394,31 @@ zstyle ':prezto:module:git:info' verbose 'yes'
### Verbose Contexts
### Verbose Contexts
| Name | Format Code | Description
| Name | Format Code | Description |
| --------- | :---------: | ----------------------------------------------------
| --------- | :---------: | --------------------- |
| added | %a | Added files count
| added | %a | Added files count |
| clean | %C | Clean state
| clean | %C | Clean state |
| deleted | %d | Deleted files count
| deleted | %d | Deleted files count |
| dirty | %D | Dirty files count
| dirty | %D | Dirty files count |
| modified | %m | Modified files count
| modified | %m | Modified files count |
| renamed | %r | Renamed files count
| renamed | %r | Renamed files count |
| unmerged | %U | Unmerged files count
| unmerged | %U | Unmerged files count |
| untracked | %u | Untracked files count
| untracked | %u | Untracked files count |
### Special Action Contexts
### Special Action Contexts
| Name | Format | Description
| Name | Format | Description |
| -------------------- | :---------: | -----------------------------------------
| -------------------- | :----: | ---------------------------- |
| apply | value | Applying patches
| apply | value | Applying patches |
| bisect | value | Binary searching for changes
| bisect | value | Binary searching for changes |
| cherry-pick | value | Cherry picking
| cherry-pick | value | Cherry picking |
| cherry-pick-sequence | value | Cherry picking sequence
| cherry-pick-sequence | value | Cherry picking sequence |
| merge | value | Merging
| merge | value | Merging |
| rebase | value | Rebasing
| rebase | value | Rebasing |
| rebase-interactive | value | Rebasing interactively
| rebase-interactive | value | Rebasing interactively |
| rebase-merge | value | Rebasing merge
| rebase-merge | value | Rebasing merge |
| revert | value | Reverting
| revert | value | Reverting |
| revert-sequence | value | Reverting sequence
| revert-sequence | value | Reverting sequence |
First, format the repository state attributes. For example, to format the branch
First, format the repository state attributes. For example, to format the branch
and remote names, define the following styles.
and remote names, define the following styles.
@ -434,19 +442,21 @@ function.
## Authors
## Authors
*The authors of this module should be contacted via the [issue tracker][6].*
_The authors of this module should be contacted via the [issue tracker][6]._
- [Sorin Ionescu ](https://github.com/sorin-ionescu )
- [Sorin Ionescu ](https://github.com/sorin-ionescu )
- [Colin Hebert ](https://github.com/ColinHebert )
- [Colin Hebert ](https://github.com/ColinHebert )
[1]: https://www.git-scm.com
[1]: https://www.git-scm.com
[2]: https://github.com/defunkt/hub
[2]: https://hub. github.com
[3]: https://www.github.com
[3]: https://www.github.com
[4]: https://www.manpagez.com/man/8/gpt/
[4]: https://www.manpagez.com/man/8/gpt/
[5]: https://www.manpagez.com/man/1/gs/
[5]: https://www.manpagez.com/man/1/gs/
[6]: https://github.com/sorin-ionescu/prezto/issues
[6]: https://github.com/sorin-ionescu/prezto/issues
[7]: https://github.com/sorin-ionescu/prezto/issues/219
[7]: https://github.com/sorin-ionescu/prezto/issues/219
[8]: https://www.kernel.org/pub/software/scm/git/docs/git-log.html
[8]: https://git-scm.com/docs/git-log
[9]: https://getgb.io/
[9]: https://git-scm.com/docs/git-submodule
[10]: https://github.com/blog/985-git-io-github-url-shortener
[10]: https://getgb.io/
[11]: https://www.manpagez.com/man/1/gm/
[11]: https://www.manpagez.com/man/1/gm/
[12]: https://github.blog/2011-11-10-git-io-github-url-shortener
[13]: ../completion#readme