Ⅰ. 插件描述
Provides nice git aliases and functions.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'zimfw/git'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'zimfw/git'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'zimfw/git'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/zimfw/git
Ⅳ. 文档说明
git
Provides handy git aliases and functions.
Many thanks to Sorin Ionescu for the
excellent original aliases.
Aliases
Git
Gis short forgit.
Branch
Gblists, creates, renames, and deletes branches.Gbccreates a new branch.Gbllists branches and their commits.GbLlists local and remote branches and their commits.Gbmrenames a branch.GbMrenames a branch even if the new branch name already exists.Gbslists branches and their commits with ancestry graphs.GbSlists local and remote branches and their commits with ancestry graphs.Gbxdeletes a branch.GbXdeletes a branch irrespective of its merged status.
Commit
Gcrecords changes to the repository.Gcacommits all modified and deleted files.GcAcommits all modified and deleted files interactivly.Gcmcommits with the given message.Gcochecks out a branch or paths to the working tree.GcOchecks out hunks from the index or the tree interactively.Gcfamends the tip of the current branch reusing the same log message as HEAD.GcFamends the tip of the current branch.Gcpapplies changes introduced by existing commits.GcPapplies changes introduced by existing commits without committing.Gcrreverts existing commits by reverting patches and recording new commits.GcRremoves the HEAD commit.Gcsshows one or more objects (blobs, trees, tags and commits).GcScommits with GPG signature.Gcucommits with fixup message using given commit.GcUcommits with squash message using given commit.Gcvverifies the GPG signature of commits.
Conflict
GCllists unmerged files.GCaadds unmerged file contents to the index.GCeexecutes merge-tool on all unmerged files.GCochecks out our changes for unmerged paths.GCOchecks out our changes for all unmerged paths.GCtchecks out their changes for unmerged paths.GCTchecks out their changes for all unmerged paths.
Data
Gddisplays information about files in the index and the work tree.Gdclists cached files.Gdxlists deleted files.Gdmlists modified files.Gdulists untracked files.Gdklists killed files.Gdilists ignored files.
Fetch
Gfdownloads objects and references from another repository.Gfcclones a repository into a new directory.Gfmfetches from and merges with another repository or local branch.Gfrfetches from and rebases on top of another repository or local branch.Gfuremoves unexisting remote-tracking references, fetches all remotes and merges.
Grep
Ggdisplays lines matching a pattern.Ggidisplays lines matching a pattern ignoring case.Ggllists files matching a pattern.GgLlists files that are not matching a pattern.Ggvdisplays lines not matching a pattern.Ggwdisplays lines matching a pattern at word boundary.
Index
Giaadds file contents to the index.GiAadds file contents to the index interactively.Giuadds file contents to the index (updates only known files).Giddisplays changes between the index and a named commit (diff).GiDdisplays changes between the index and a named commit (word diff).Girresets the current HEAD to the specified state.GiRresets the current index interactively.Gixremoves files/directories from the index (recursively).GiXremoves files/directories from the index (recursively and forced).
Log
Gldisplays the log.Glsdisplays the stats log.Glddisplays the diff log.Glodisplays the one line log.GlOdisplays the one line log with authors and dates.Glgdisplays the graph log.GlGdisplays the graph log with authors and dates.Glvdisplays the log, verifying the GPG signature of commits.Glcdisplays the commit count for each contributor in descending order.Glrmanages reflog information.
Merge
Gmjoins two or more development histories together.Gmaaborts the conflict resolution, and reconstructs the pre-merge state.GmCperforms the merge but does not commit.GmFcreates a merge commit even if the merge could be resolved as a fast-forward.GmSperforms the merge and GPG-signs the resulting commit.Gmvverifies the GPG signature of the tip commit of the side branch being merged.Gmtruns the merge conflict resolution tools to resolve conflicts.
Push
Gpupdates remote refs along with associated objects.Gpfforces a push safely (with "lease").GpFforces a push.Gpapushes all branches.GpApushes all branches and tags.Gptpushes all tags.Gpcpushes the current branch and adds origin as an upstream reference for it.Gpppulls and pushes the current branch from origin to origin.
Rebase
Grforward-ports local commits to the updated upstream head.Graaborts the rebase.Grccontinues the rebase after merge conflicts are resolved.Grimakes a list of commits to be rebased and opens the editor.Grsskips the current patch.GrSrebases and GPG-signs the commits.
Remote
GRmanages tracked repositories.GRllists remote names and their URLs.GRaadds a new remote.GRxremoves a remote.GRmrenames a remote.GRufetches remotes updates.GRpprunes all stale remote tracking branches.GRsshows information about a given remote.
Stash
Gsstashes the changes of the dirty working directory.Gsaapplies the changes recorded in a stash to the working directory.Gsxdrops a stashed state.GsXdrops all the stashed states.Gsllists stashed states.Gsddisplays changes between the stash and its original parent.Gspremoves and applies a single stashed state from the stash list.Gsrrecovers a given stashed state.Gssstashes the working directory changes, including untracked files.GsSstashes the working directory changes interactively.Gswstashes the working directory changes retaining the index.Gsuunapplies (reverts) applied changes.
Submodule
GSinitializes, updates, or inspects submodules.GSaadds given a repository as a submodule.GSfevaluates a shell command in each of checked out submodules.GSiinitializes submodules.GSIinitializes and clones submodules recursively.GSllists the commits of all submodules.GSmmoves a submodule.GSssynchronizes remote URL of submodules to the value specified in.gitmodules.GSufetches and merges the latest changes for all submodules.GSxremoves a submodule.
Tag
Gtcreates, lists, deletes or verifies a tag object signed with GPG.Gtscreates a GPG-signed tag.Gtvverifies the GPG signature of tags.Gtxdeletes tags with given names.
Working tree
Gwsdisplays working-tree status in the short format.GwSdisplays working-tree status.Gwddisplays changes between the working tree and the index (diff).GwDdisplays changes between the working tree and the index (word diff).Gwrresets the current HEAD to the specified state, does not touch the index nor the working tree.GwRresets the current HEAD, index and working tree to the specified state.Gwccleans untracked files from the working tree (dry-run).GwCcleans untracked files from the working tree.Gwxremoves files from the working tree and from the index recursively.GwXremoves files from the working tree and from the index recursively and forcefully.
Misc
G..changes the current directory to the top level of the working tree.G?looks up the aliases defined here (short forgit-alias-lookup).
Settings
By default, all aliases are defined with an upper case G prefix, as you can
see above. You can use the following zstyle if you wish to customize the prefix
used to generate all aliases:
zstyle ':zim:git' aliases-prefix 'g'
Be careful if changing the prefix to lower case g, as the generated aliases
can shadow many commands, like gpt
for the GUID partition table maintenance utility.
Functions
git-alias-lookuplists the aliases defined here searching by the given pattern.git-branch-currentdisplays the current branch.git-branch-delete-interactiveasks for confirmation to also delete the upstream remote branch(es).git-dirdisplays the path to the Git directory.git-ignore-addadds any arguments to the .gitignore in the project root.git-rootdisplays the path to the working tree root.git-stash-clear-interactiveasks for confirmation before clearing the stash.git-stash-recoverrecovers given dropped stashed states.git-submodule-movemoves a submodule.git-submodule-removeremoves a submodule.