Unverified Commit cad48e38 authored by Marc Cornellà's avatar Marc Cornellà Committed by GitHub
Browse files

Merge branch 'master' into fabric_task_description

parents 225425fe 40df67bc
function setup_using_base_dir() {
# Declare all variables local not no mess with outside env in any way
local fzf_base
local fzf_shell
local fzfdirs
local dir
test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}"
if [[ -z "${fzf_base}" ]]; then
fzfdirs=(
"${HOME}/.fzf"
"/usr/local/opt/fzf"
"/usr/share/fzf"
)
for dir in ${fzfdirs}; do
if [[ -d "${dir}" ]]; then
fzf_base="${dir}"
break
fi
done
if [[ -z "${fzf_base}" ]]; then
if (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then
if [[ -d "${dir}" ]]; then
fzf_base="${dir}"
fi
fi
fi
fi
if [[ -d "${fzf_base}" ]]; then
# Fix fzf shell directory for Archlinux package
if [[ ! -d "${fzf_base}/shell" ]] && [[ -f /etc/arch-release ]]; then
fzf_shell="${fzf_base}"
else
fzf_shell="${fzf_base}/shell"
fi
# Setup fzf binary path
if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then
export PATH="$PATH:$fzf_base/bin"
fi
# Auto-completion
if [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then
[[ $- == *i* ]] && source "${fzf_shell}/completion.zsh" 2> /dev/null
fi
# Key bindings
if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
source "${fzf_shell}/key-bindings.zsh"
fi
else
return 1
fi
}
function setup_using_debian_package() {
(( $+commands[dpkg] )) && dpkg -s fzf &> /dev/null
if (( $? )); then
# Either not a debian based distro, or no fzf installed. In any case skip ahead
return 1
fi
# NOTE: There is no need to configure PATH for debian package, all binaries
# are installed to /usr/bin by default
local completions="/usr/share/zsh/vendor-completions/_fzf"
local key_bindings="/usr/share/doc/fzf/examples/key-bindings.zsh"
# Auto-completion
if [[ $- == *i* ]] && [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then
source $completions 2> /dev/null
fi
# Key bindings
if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
source $key_bindings
fi
return 0
}
function indicate_error() {
print "[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.\n"\
"Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc" >&2
}
# Check for debian package first, because it easy to short cut
# Indicate to user that fzf installation not found if nothing worked
setup_using_debian_package || setup_using_base_dir || indicate_error
unset -f setup_using_debian_package setup_using_base_dir indicate_error
# gatsby autocomplete plugin
* Adds autocomplete options for all gatsby commands.
## Requirements
In order to make this work, you will need to have gatsby set up in your path.
#compdef gatsby
#autoload
# in order to make this work, you will need to have gatsby
# https://www.gatsbyjs.org/
local -a _1st_arguments
_1st_arguments=(
'develop:Start development server. Watches files, rebuilds, and hot reloads if something changes'
'build:Build a Gatsby project.'
'serve:Serve previously built Gatsby site.'
'info:Get environment information for debugging and issue reporting'
'clean:Wipe the local gatsby environment including built assets and cache'
'repl:Get a node repl with context of Gatsby environment, see (add docs link here)'
'new: [rootPath] [starter] Create new Gatsby project.'
'telemetry:Enable or disable Gatsby anonymous analytics collection.'
)
_arguments -C '*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "gatsby subcommand" _1st_arguments
return
fi
# gcloud
This plugin provides completion support for the
[Google Cloud SDK CLI](https://cloud.google.com/sdk/gcloud/).
To use it, add `gcloud` to the plugins array in your zshrc file.
```zsh
plugins=(... gcloud)
```
It relies on you having installed the SDK using one of the supported options
listed [here](https://cloud.google.com/sdk/install).
## Plugin Options
* Set `CLOUDSDK_HOME` in your `zshrc` file before you load oh-my-zsh if you have
your GCloud SDK installed in a non-standard location. The plugin will use this
as the base for your SDK if it finds it set already.
* If you do not have a `python2` in your `PATH` you'll also need to set the
`CLOUDSDK_PYTHON` environment variable at the end of your `.zshrc`. This is
used by the SDK to call a compatible interpreter when you run one of the
SDK commands.
#####################################################
# gcloud plugin for oh-my-zsh #
# Author: Ian Chesal (github.com/ianchesal) #
#####################################################
if [[ -z "${CLOUDSDK_HOME}" ]]; then
search_locations=(
"$HOME/google-cloud-sdk"
"/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
"/usr/share/google-cloud-sdk"
"/snap/google-cloud-sdk/current"
"/usr/lib64/google-cloud-sdk/"
"/opt/google-cloud-sdk"
)
for gcloud_sdk_location in $search_locations; do
if [[ -d "${gcloud_sdk_location}" ]]; then
CLOUDSDK_HOME="${gcloud_sdk_location}"
break
fi
done
fi
if (( ${+CLOUDSDK_HOME} )); then
if (( ! $+commands[gcloud] )); then
# Only source this if GCloud isn't already on the path
if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then
source "${CLOUDSDK_HOME}/path.zsh.inc"
fi
fi
source "${CLOUDSDK_HOME}/completion.zsh.inc"
export CLOUDSDK_HOME
fi
## ZSH-Geeknote ## ZSH-Geeknote
[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for [oh-my-zsh framework](http://github.com/robbyrussell/oh-my-zsh). [Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for oh-my-zsh.
Plugins provides: Plugins provides:
......
# Gem plugin
This plugin adds completions and aliases for [Gem](https://rubygems.org/). The completions include the common `gem` subcommands as well as the installed gems in the current directory.
To use it, add `gem` to the plugins array in your zshrc file:
```zsh
plugins=(... gem)
```
## Aliases
| Alias | Command | Description |
|----------------------|-------------------------------|--------------------------------------------|
| gemb | `gem build *.gemspec` | Build a gem from a gemspec |
| gemp | `gem push *.gem` | Push a gem up to the gem server |
| gemy [gem] [version] | `gem yank [gem] -v [version]` | Remove a pushed gem version from the index |
# Git auto-fetch
Automatically fetches all changes from all remotes while you are working in git-initialized directory.
#### Usage
Add `git-auto-fetch` to the plugins array in your zshrc file:
```shell
plugins=(... git-auto-fetch)
```
Every time you launch a command in your shell all remotes will be fetched in background.
By default autofetch will be triggered only if last fetch was done at least 60 seconds ago.
You can change fetch interval in your .zshrc:
```
GIT_AUTO_FETCH_INTERVAL=1200 #in seconds
```
Log of `git fetch --all` will be saved into `.git/FETCH_LOG`
#### Toggle auto fetch per folder
If you are using mobile connection or for any other reason you can disable git-auto-fetch for any folder:
```shell
$ cd to/your/project
$ git-auto-fetch
disabled
$ git-auto-fetch
enabled
```
GIT_AUTO_FETCH_INTERVAL=${GIT_AUTO_FETCH_INTERVAL:=60}
function git-fetch-all {
(`git rev-parse --is-inside-work-tree 2>/dev/null` &&
dir=`git rev-parse --git-dir` &&
[[ ! -f $dir/NO_AUTO_FETCH ]] &&
(( `date +%s` - `date -r $dir/FETCH_LOG +%s 2>/dev/null || echo 0` > $GIT_AUTO_FETCH_INTERVAL )) &&
git fetch --all 2>/dev/null &>! $dir/FETCH_LOG &)
}
function git-auto-fetch {
`git rev-parse --is-inside-work-tree 2>/dev/null` || return
guard="`git rev-parse --git-dir`/NO_AUTO_FETCH"
(rm $guard 2>/dev/null &&
echo "${fg_bold[green]}enabled${reset_color}") ||
(touch $guard &&
echo "${fg_bold[red]}disabled${reset_color}")
}
# Override zle-line-init if it exists
if (( $+functions[zle-line-init] )); then
eval "override-git-auto-fetch-$(declare -f zle-line-init)"
function zle-line-init () {
git-fetch-all
override-git-auto-fetch-zle-line-init
}
else
function zle-line-init () {
git-fetch-all
}
fi
zle -N zle-line-init
# Git Escape Magic
This plugin is copied from the original at
https://github.com/knu/zsh-git-escape-magic. All credit for the
functionality enabled by this plugin should go to @knu.
An excerpt from that project's readme explains its purpose.
> It eliminates the need for manually escaping those meta-characters. The zle function it provides is context aware and recognizes the characteristics of each subcommand of git. Every time you type one of these meta-characters on a git command line, it automatically escapes the meta-character with a backslash as necessary and as appropriate.
## Usage
To use this plugin, add it to your list of plugins in your `.zshrc` file.
**NOTE**: If you use url-quote-magic, it must be included before this
plugin runs to prevent any conflicts.
# -*- mode: sh -*-
#
# git-escape-magic - zle tweak for git command line arguments
#
# Copyright (c) 2011, 2012, 2014 Akinori MUSHA
# Licensed under the 2-clause BSD license.
#
# This tweak eliminates the need for manually escaping shell
# meta-characters such as [~^{}] that are used for specifying a git
# object (commit or tree). Every time you type one of these
# characters on a git command line, it is automatically escaped with a
# backslash as necessary and as appropriate.
#
# If you want to use this with url-quote-magic, make sure to enable it
# first.
#
# Usage:
# autoload -Uz git-escape-magic
# git-escape-magic
#
git-escape-magic.self-insert() {
emulate -L zsh
setopt extendedglob
local self_insert_function
zstyle -s ':git-escape-magic' self-insert-function self_insert_function
if [[ "$KEYS" == [{}~^]* ]] && {
local qkey="${(q)KEYS}"
[[ "$KEYS" != "$qkey" ]]
} && {
local lbuf="$LBUFFER$qkey"
[[ "${(Q)LBUFFER}$KEYS" == "${(Q)lbuf}" ]]
} && {
local -a words
words=("${(@Q)${(z)lbuf}}")
[[ "$words[(i)(*/|)git(|-[^/]##)]" -le $#words ]]
}
then
local i
i="$words[(I)([;(){\&]|\&[\&\!]|\|\||[=<>]\(*)]"
if [[ $i -gt 0 ]]; then
shift $((i-1)) words
if [[ "$words[1]" == [\=\<\>]\(* ]]; then
words[1]="${words[1]#[=<>]\(}"
else
[[ "$words[1]" == \; && $words[2] == (then|else|elif|do) ]] && shift words
shift words
fi
fi
while [[ "$words[1]" == (if|while|until|\!) ]]; do
shift words
done
while [[ "$words[1]" == [A-Za-z_][A-Za-z0-9_]#=* ]]; do
shift words
done
[[ "$words[1]" == (*/|)git(|-[^/]##) ]] && {
local subcommand
subcommand="${words[1]##*/git-}"
if [[ -z "$subcommand" ]]; then
shift words
subcommand="$words[1]"
fi
[[ $#words -ge 2 ]]
} &&
case "$subcommand" in
# commands that may take pathspec but never take refspec with [{}~^]
(add|rm|am|apply|check-attr|checkout-index|clean|clone|config|diff-files|hash-object|help|index-pack|mailinfo|mailsplit|merge-file|merge-index|mergetool|mktag|mv|pack-objects|pack-redundant|relink|send-email|show-index|show-ref|stage|status|verify-pack)
false ;;
# commands that may take pathspec but rarely take refspec with [{}~^]
(for-each-ref|grep|ls-files|update-index)
false ;;
(archive|ls-tree)
! [[ $#words -ge 3 &&
"$words[-2]" == [^-]* ]] ;;
(diff-tree)
! [[ $#words -ge 4 &&
"$words[-2]" == [^-]* &&
"$words[-3]" == [^-]* ]] ;;
(*)
[[ $words[(i)--] -gt $#words ]] ;;
esac &&
case "${words[-1]%%"$KEYS"}" in
(*[@^])
[[ "$KEYS" == [{~^]* ]] ;;
(*[@^]\{[^}]##)
[[ "$KEYS" == \}* ]] ;;
(?*)
[[ "$KEYS" == [~^]* ]] ;;
(*)
false ;;
esac &&
LBUFFER="$LBUFFER\\"
fi
zle "$self_insert_function"
}
git-escape-magic.on() {
emulate -L zsh
local self_insert_function="${$(zle -lL | awk \
'$1=="zle"&&$2=="-N"&&$3=="self-insert"{print $4;exit}'):-.self-insert}"
[[ "$self_insert_function" == git-escape-magic.self-insert ]] &&
return 0
# For url-quote-magic which does not zle -N itself
zle -la "$self_insert_function" || zle -N "$self_insert_function"
zstyle ':git-escape-magic' self-insert-function "$self_insert_function"
zle -A git-escape-magic.self-insert self-insert
return 0
}
git-escape-magic.off() {
emulate -L zsh
local self_insert_function
zstyle -s ':git-escape-magic' self-insert-function self_insert_function
[[ -n "$self_insert_function" ]] &&
zle -A "$self_insert_function" self-insert
return 0
}
zle -N git-escape-magic.self-insert
zle -N git-escape-magic.on
zle -N git-escape-magic.off
git-escape-magic() {
git-escape-magic.on
}
[[ -o kshautoload ]] || git-escape-magic "$@"
# Automatically detect and escape zsh globbing meta-characters when used with
# git refspec characters like `[^~{}]`. NOTE: This must be loaded _after_
# url-quote-magic.
#
# This trick is detailed at https://github.com/knu/zsh-git-escape-magic and is
# what allowed this plugin to exist.
autoload -Uz git-escape-magic
git-escape-magic
# git-extras # git-extras
This plugin provides completion definitions for some of the commands defined by [git-extras](http://github.com/tj/git-extras). This plugin provides completion definitions for some of the commands defined by [git-extras](https://github.com/tj/git-extras).
## Setup notes ## Setup notes
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Description # Description
# ----------- # -----------
# #
# Completion script for git-extras (http://github.com/tj/git-extras). # Completion script for git-extras (https://github.com/tj/git-extras).
# #
# This depends on and reuses some of the internals of the _git completion # This depends on and reuses some of the internals of the _git completion
# function that ships with zsh itself. It will not work with the _git that ships # function that ships with zsh itself. It will not work with the _git that ships
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
# Inspirations # Inspirations
# ----------- # -----------
# #
# * git-extras (http://github.com/tj/git-extras) # * git-extras (https://github.com/tj/git-extras)
# * git-flow-completion (http://github.com/bobthecow/git-flow-completion) # * git-flow-completion (https://github.com/bobthecow/git-flow-completion)
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
...@@ -47,6 +47,14 @@ __gitex_commits() { ...@@ -47,6 +47,14 @@ __gitex_commits() {
_describe -t commits commit commits && ret=0 _describe -t commits commit commits && ret=0
} }
__gitex_remote_names() {
local expl
declare -a remote_names
remote_names=(${(f)"$(_call_program remotes git remote 2>/dev/null)"})
__git_command_successful || return
_wanted remote-names expl remote-name compadd $* - $remote_names
}
__gitex_tag_names() { __gitex_tag_names() {
local expl local expl
declare -a tag_names declare -a tag_names
...@@ -69,7 +77,11 @@ __gitex_specific_branch_names() { ...@@ -69,7 +77,11 @@ __gitex_specific_branch_names() {
declare -a branch_names declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/}) branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/})
__git_command_successful || return __git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names _wanted branch-names expl branch-name compadd - $branch_names
}
__gitex_chore_branch_names() {
__gitex_specific_branch_names 'chore'
} }
__gitex_feature_branch_names() { __gitex_feature_branch_names() {
...@@ -102,6 +114,11 @@ __gitex_author_names() { ...@@ -102,6 +114,11 @@ __gitex_author_names() {
} }
# subcommands # subcommands
_git-authors() {
_arguments -C \
'(--list -l)'{--list,-l}'[show authors]' \
'--no-email[without email]' \
}
_git-bug() { _git-bug() {
local curcontext=$curcontext state line ret=1 local curcontext=$curcontext state line ret=1
...@@ -126,8 +143,16 @@ _git-bug() { ...@@ -126,8 +143,16 @@ _git-bug() {
_arguments -C \ _arguments -C \
':branch-name:__gitex_bug_branch_names' ':branch-name:__gitex_bug_branch_names'
;; ;;
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac esac
return 0
esac esac
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
} }
...@@ -136,6 +161,40 @@ _git-changelog() { ...@@ -136,6 +161,40 @@ _git-changelog() {
'(-l --list)'{-l,--list}'[list commits]' \ '(-l --list)'{-l,--list}'[list commits]' \
} }
_git-chore() {
local curcontext=$curcontext state line ret=1
declare -A opt_args
_arguments -C \
': :->command' \
'*:: :->option-or-argument' && ret=0
case $state in
(command)
declare -a commands
commands=(
'finish:merge and delete the chore branch'
)
_describe -t commands command commands && ret=0
;;
(option-or-argument)
curcontext=${curcontext%:*}-$line[1]:
case $line[1] in
(finish)
_arguments -C \
':branch-name:__gitex_chore_branch_names'
;;
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac
return 0
esac
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
}
_git-contrib() { _git-contrib() {
...@@ -149,6 +208,27 @@ _git-count() { ...@@ -149,6 +208,27 @@ _git-count() {
'--all[detailed commit count]' '--all[detailed commit count]'
} }
_git-create-branch() {
local curcontext=$curcontext state line
_arguments -C \
': :->command' \
'*:: :->option-or-argument'
case "$state" in
(command)
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
;;
(option-or-argument)
curcontext=${curcontext%:*}-$line[1]:
case $line[1] in
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac
esac
}
_git-delete-branch() { _git-delete-branch() {
_arguments \ _arguments \
...@@ -220,10 +300,17 @@ _git-feature() { ...@@ -220,10 +300,17 @@ _git-feature() {
_arguments -C \ _arguments -C \
':branch-name:__gitex_feature_branch_names' ':branch-name:__gitex_feature_branch_names'
;; ;;
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac esac
return 0
esac esac
}
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
}
_git-graft() { _git-graft() {
_arguments \ _arguments \
...@@ -231,14 +318,39 @@ _git-graft() { ...@@ -231,14 +318,39 @@ _git-graft() {
':dest-branch-name:__gitex_branch_names' ':dest-branch-name:__gitex_branch_names'
} }
_git-guilt() {
_arguments -C \
'(--email -e)'{--email,-e}'[display author emails instead of names]' \
'(--ignore-whitespace -w)'{--ignore-whitespace,-w}'[ignore whitespace only changes]' \
'(--debug -d)'{--debug,-d}'[output debug information]' \
'-h[output usage information]'
}
_git-ignore() { _git-ignore() {
_arguments -C \ _arguments -C \
'(--local -l)'{--local,-l}'[show local gitignore]' \ '(--local -l)'{--local,-l}'[show local gitignore]' \
'(--global -g)'{--global,-g}'[show global gitignore]' '(--global -g)'{--global,-g}'[show global gitignore]' \
'(--private -p)'{--private,-p}'[show repo gitignore]'
} }
_git-ignore() {
_arguments -C \
'(--append -a)'{--append,-a}'[append .gitignore]' \
'(--replace -r)'{--replace,-r}'[replace .gitignore]' \
'(--list-in-table -l)'{--list-in-table,-l}'[print available types in table format]' \
'(--list-alphabetically -L)'{--list-alphabetically,-L}'[print available types in alphabetical order]' \
'(--search -s)'{--search,-s}'[search word in available types]'
}
_git-merge-into() {
_arguments '--ff-only[merge only fast-forward]'
_arguments \
':src:__gitex_branch_names' \
':dest:__gitex_branch_names'
}
_git-missing() { _git-missing() {
_arguments \ _arguments \
':first-branch-name:__gitex_branch_names' \ ':first-branch-name:__gitex_branch_names' \
...@@ -269,8 +381,16 @@ _git-refactor() { ...@@ -269,8 +381,16 @@ _git-refactor() {
_arguments -C \ _arguments -C \
':branch-name:__gitex_refactor_branch_names' ':branch-name:__gitex_refactor_branch_names'
;; ;;
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac esac
return 0
esac esac
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
} }
...@@ -279,6 +399,23 @@ _git-squash() { ...@@ -279,6 +399,23 @@ _git-squash() {
':branch-name:__gitex_branch_names' ':branch-name:__gitex_branch_names'
} }
_git-stamp() {
_arguments -C \
'(--replace -r)'{--replace,-r}'[replace stamps with same id]'
}
_git-standup() {
_arguments -C \
'-a[Specify the author of commits. Use "all" to specify all authors.]' \
'-d[Show history since N days ago]' \
'-D[Specify the date format displayed in commit history]' \
'-f[Fetch commits before showing history]' \
'-g[Display GPG signed info]' \
'-h[Display help message]' \
'-L[Enable the inclusion of symbolic links]' \
'-m[The depth of recursive directory search]'
}
_git-summary() { _git-summary() {
_arguments '--line[summarize with lines rather than commits]' _arguments '--line[summarize with lines rather than commits]'
__gitex_commits __gitex_commits
...@@ -291,45 +428,71 @@ _git-undo(){ ...@@ -291,45 +428,71 @@ _git-undo(){
'(--hard -h)'{--hard,-h}'[wipes your commit(s)]' '(--hard -h)'{--hard,-h}'[wipes your commit(s)]'
} }
zstyle ':completion:*:*:git:*' user-commands \ zstyle -g existing_user_commands ':completion:*:*:git:*' user-commands
zstyle ':completion:*:*:git:*' user-commands $existing_user_commands \
alias:'define, search and show aliases' \ alias:'define, search and show aliases' \
archive-file:'export the current HEAD of the git repository to a archive' \ archive-file:'export the current head of the git repository to an archive' \
authors:'generate authors report' \
back:'undo and stage latest commits' \ back:'undo and stage latest commits' \
bug:'create a bug branch' \ bug:'create bug branch' \
changelog:'populate changelog file with commits since the previous tag' \ bulk:'run bulk commands' \
commits-since:'list commits since a given date' \ changelog:'generate a changelog report' \
contrib:'display author contributions' \ chore:'create chore branch' \
count:'count commits' \ clear-soft:'soft clean up a repository' \
create-branch:'create local and remote branch' \ clear:'rigorously clean up a repository' \
delete-branch:'delete local and remote branch' \ commits-since:'show commit logs since some date' \
delete-merged-branches:'delete merged branches'\ contrib:'show user contributions' \
delete-submodule:'delete submodule' \ count:'show commit count' \
delete-tag:'delete local and remote tag' \ create-branch:'create branches' \
effort:'display effort statistics' \ delete-branch:'delete branches' \
extras:'git-extras' \ delete-merged-branches:'delete merged branches' \
feature:'create a feature branch' \ delete-submodule:'delete submodules' \
fork:'fork a repo on github' \ delete-tag:'delete tags' \
fresh-branch:'create empty local branch' \ delta:'lists changed files' \
gh-pages:'create the GitHub Pages branch' \ effort:'show effort statistics on file(s)' \
graft:'merge commits from source branch to destination branch' \ extras:'awesome git utilities' \
ignore:'add patterns to .gitignore' \ feature:'create/merge feature branch' \
info:'show info about the repository' \ force-clone:'overwrite local repositories with clone' \
local-commits:'list unpushed commits on the local branch' \ fork:'fork a repo on GitHub' \
fresh-branch:'create fresh branches' \
gh-pages:'create the GitHub pages branch' \
graft:'merge and destroy a given branch' \
guilt:'calculate change between two revisions' \
ignore-io:'get sample gitignore file' \
ignore:'add .gitignore patterns' \
info:'returns information on current repository' \
local-commits:'list local commits' \
lock:'lock a file excluded from version control' \ lock:'lock a file excluded from version control' \
locked:'ls files that have been locked' \ locked:'ls files that have been locked' \
merge-into:'merge one branch into another' \
merge-repo:'merge two repo histories' \
missing:'show commits missing from another branch' \ missing:'show commits missing from another branch' \
mr:'checks out a merge request locally' \
obliterate:'rewrite past commits to remove some files' \
pr:'checks out a pull request locally' \ pr:'checks out a pull request locally' \
psykorebase:'rebase a branch with a merge commit' \
pull-request:'create pull request to GitHub project' \
reauthor:'replace the author and/or committer identities in commits and tags' \
rebase-patch:'rebases a patch' \ rebase-patch:'rebases a patch' \
refactor:'create a refactor branch' \ refactor:'create refactor branch' \
release:'commit, tag and push changes to the repository' \ release:'commit, tag and push changes to the repository' \
rename-branch:'rename a branch' \
rename-tag:'rename a tag' \ rename-tag:'rename a tag' \
repl:'read-eval-print-loop' \ repl:'git read-eval-print-loop' \
reset-file:'reset one file' \ reset-file:'reset one file' \
root:'show path of root' \ root:'show path of root' \
setup:'setup a git repository' \ scp:'copy files to ssh compatible `git-remote`' \
sed:'replace patterns in git-controlled files' \
setup:'set up a git repository' \
show-merged-branches:'show merged branches' \
show-tree:'show branch tree of commit history' \ show-tree:'show branch tree of commit history' \
squash:'merge commits from source branch into the current one as a single commit' \ show-unmerged-branches:'show unmerged branches' \
summary:'repository summary' \ squash:'import changes from a branch' \
touch:'one step creation of new files' \ stamp:'stamp the last commit message' \
undo:'remove the latest commit' \ standup:'recall the commit history' \
summary:'show repository summary' \
sync:'sync local branch with remote branch' \
touch:'touch and add file to the index' \
undo:'remove latest commits' \
unlock:'unlock a file excluded from version control' unlock:'unlock a file excluded from version control'
# git-flow (AVH Edition) plugin
This plugin adds completion for the [git-flow (AVH Edition)](https://github.com/petervanderdoes/gitflow-avh).
The AVH Edition of the git extensions that provides high-level repository operations for [Vincent Driessen's branching model](https://nvie.com/posts/a-successful-git-branching-model/).
To use it, add `git-flow-avh` to the plugins array in your zshrc file:
```zsh
plugins=(... git-flow-avh)
```
## Requirements
1. The git-flow tool has to be [installed](https://github.com/petervanderdoes/gitflow-avh#installing-git-flow)
separately.
2. You have to use zsh's git completion instead of the git project's git completion. This is typically
done by default so you don't need to do anything else. If you installed git with Homebrew you
might have to uninstall the git completion it's bundled with.
#!zsh
#
# Installation
# ------------
#
# To achieve git-flow completion nirvana:
#
# 0. Update your zsh's git-completion module to the newest verion.
# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
#
# 1. Install this file. Either:
#
# a. Place it in your .zshrc:
#
# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.zsh) and put the following line in
# your .zshrc:
#
# source ~/.git-flow-completion.zsh
#
# c. Or, use this file as a oh-my-zsh plugin.
#
_git-flow () _git-flow ()
{ {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments -C \ _arguments -C \
':command:->command' \ ':command:->command' \
'*::options:->options' '*::options:->options'
case $state in case $state in
(command) (command)
local -a subcommands local -a subcommands
subcommands=( subcommands=(
'init:Initialize a new git repo with support for the branching model.' 'init:Initialize a new git repo with support for the branching model.'
'feature:Manage your feature branches.' 'feature:Manage your feature branches.'
'config:Manage your configuration.' 'bugfix:Manage your bugfix branches.'
'release:Manage your release branches.' 'config:Manage your configuration.'
'hotfix:Manage your hotfix branches.' 'release:Manage your release branches.'
'support:Manage your support branches.' 'hotfix:Manage your hotfix branches.'
'version:Shows version information.' 'support:Manage your support branches.'
'finish:Finish the branch you are currently on.' 'version:Shows version information.'
'delete:Delete the branch you are currently on.' 'finish:Finish the branch you are currently on.'
'publish:Publish the branch you are currently on.' 'delete:Delete the branch you are currently on.'
) 'publish:Publish the branch you are currently on.'
_describe -t commands 'git flow' subcommands 'rebase:Rebase the branch you are currently on.'
;; )
_describe -t commands 'git flow' subcommands
(options) ;;
case $line[1] in
(options)
(init) case $line[1] in
_arguments \
-f'[Force setting of gitflow branches, even if already configured]' (init)
;; _arguments \
-f'[Force setting of gitflow branches, even if already configured]'
(version) ;;
;;
(version)
(hotfix) ;;
__git-flow-hotfix
;; (hotfix)
__git-flow-hotfix
(release) ;;
__git-flow-release
;; (release)
__git-flow-release
(feature) ;;
__git-flow-feature
;; (feature)
(config) __git-flow-feature
__git-flow-config ;;
;; (bugfix)
__git-flow-bugfix
esac ;;
;;
esac (config)
__git-flow-config
;;
esac
;;
esac
} }
__git-flow-release () __git-flow-release ()
{ {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments -C \ _arguments -C \
':command:->command' \ ':command:->command' \
'*::options:->options' '*::options:->options'
case $state in case $state in
(command) (command)
local -a subcommands local -a subcommands
subcommands=( subcommands=(
'start:Start a new release branch.' 'start:Start a new release branch.'
'finish:Finish a release branch.' 'finish:Finish a release branch.'
'list:List all your release branches. (Alias to `git flow release`)' 'list:List all your release branches. (Alias to `git flow release`)'
'publish:Publish release branch to remote.' 'publish:Publish release branch to remote.'
'track:Checkout remote release branch.' 'track:Checkout remote release branch.'
'delete:Delete a release branch.' 'rebase:Rebase from integration branch.'
) 'delete:Delete a release branch.'
_describe -t commands 'git flow release' subcommands )
_arguments \ _describe -t commands 'git flow release' subcommands
-v'[Verbose (more) output]' _arguments \
;; -v'[Verbose (more) output]'
;;
(options)
case $line[1] in (options)
case $line[1] in
(start)
_arguments \ (start)
-F'[Fetch from origin before performing finish]'\ _arguments \
':version:__git_flow_version_list' -F'[Fetch from origin before performing finish]'\
;; ':version:__git_flow_version_list'
;;
(finish)
_arguments \ (finish)
-F'[Fetch from origin before performing finish]' \ _arguments \
-s'[Sign the release tag cryptographically]'\ -F'[Fetch from origin before performing finish]' \
-u'[Use the given GPG-key for the digital signature (implies -s)]'\ -s'[Sign the release tag cryptographically]'\
-m'[Use the given tag message]'\ -u'[Use the given GPG-key for the digital signature (implies -s)]'\
-p'[Push to $ORIGIN after performing finish]'\ -m'[Use the given tag message]'\
':version:__git_flow_version_list' -p'[Push to $ORIGIN after performing finish]'\
;; ':version:__git_flow_version_list'
;;
(delete)
_arguments \ (delete)
-f'[Force deletion]' \ _arguments \
-r'[Delete remote branch]' \ -f'[Force deletion]' \
':version:__git_flow_version_list' -r'[Delete remote branch]' \
;; ':version:__git_flow_version_list'
;;
(publish)
_arguments \ (publish)
':version:__git_flow_version_list' _arguments \
;; ':version:__git_flow_version_list'
;;
(track)
_arguments \ (track)
':version:__git_flow_version_list' _arguments \
;; ':version:__git_flow_version_list'
;;
*)
_arguments \ (rebase)
-v'[Verbose (more) output]' _arguments \
;; -i'[Do an interactive rebase]' \
esac ':branch:__git_branch_names'
;; ;;
esac
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
} }
__git-flow-hotfix () __git-flow-hotfix ()
{ {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments -C \ _arguments -C \
':command:->command' \ ':command:->command' \
'*::options:->options' '*::options:->options'
case $state in case $state in
(command) (command)
local -a subcommands local -a subcommands
subcommands=( subcommands=(
'start:Start a new hotfix branch.' 'start:Start a new hotfix branch.'
'finish:Finish a hotfix branch.' 'finish:Finish a hotfix branch.'
'delete:Delete a hotfix branch.' 'delete:Delete a hotfix branch.'
'list:List all your hotfix branches. (Alias to `git flow hotfix`)' 'rebase:Rebase from integration branch.'
) 'list:List all your hotfix branches. (Alias to `git flow hotfix`)'
_describe -t commands 'git flow hotfix' subcommands 'rename:Rename a hotfix branch.'
_arguments \ )
-v'[Verbose (more) output]' _describe -t commands 'git flow hotfix' subcommands
;; _arguments \
-v'[Verbose (more) output]'
(options) ;;
case $line[1] in
(options)
(start) case $line[1] in
_arguments \
-F'[Fetch from origin before performing finish]'\ (start)
':hotfix:__git_flow_version_list'\ _arguments \
':branch-name:__git_branch_names' -F'[Fetch from origin before performing finish]'\
;; ':hotfix:__git_flow_version_list'\
':branch-name:__git_branch_names'
(finish) ;;
_arguments \
-F'[Fetch from origin before performing finish]' \ (finish)
-s'[Sign the release tag cryptographically]'\ _arguments \
-u'[Use the given GPG-key for the digital signature (implies -s)]'\ -F'[Fetch from origin before performing finish]' \
-m'[Use the given tag message]'\ -s'[Sign the release tag cryptographically]'\
-p'[Push to $ORIGIN after performing finish]'\ -u'[Use the given GPG-key for the digital signature (implies -s)]'\
':hotfix:__git_flow_hotfix_list' -m'[Use the given tag message]'\
;; -p'[Push to $ORIGIN after performing finish]'\
':hotfix:__git_flow_hotfix_list'
(delete) ;;
_arguments \
-f'[Force deletion]' \ (delete)
-r'[Delete remote branch]' \ _arguments \
':hotfix:__git_flow_hotfix_list' -f'[Force deletion]' \
;; -r'[Delete remote branch]' \
':hotfix:__git_flow_hotfix_list'
*) ;;
_arguments \
-v'[Verbose (more) output]' (rebase)
;; _arguments \
esac -i'[Do an interactive rebase]' \
;; ':branch:__git_branch_names'
esac ;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
} }
__git-flow-feature () __git-flow-feature ()
{ {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments -C \ _arguments -C \
':command:->command' \ ':command:->command' \
'*::options:->options' '*::options:->options'
case $state in case $state in
(command) (command)
local -a subcommands local -a subcommands
subcommands=( subcommands=(
'start:Start a new feature branch.' 'start:Start a new feature branch.'
'finish:Finish a feature branch.' 'finish:Finish a feature branch.'
'delete:Delete a feature branch.' 'delete:Delete a feature branch.'
'list:List all your feature branches. (Alias to `git flow feature`)' 'list:List all your feature branches. (Alias to `git flow feature`)'
'publish:Publish feature branch to remote.' 'publish:Publish feature branch to remote.'
'track:Checkout remote feature branch.' 'track:Checkout remote feature branch.'
'diff:Show all changes.' 'diff:Show all changes.'
'rebase:Rebase from integration branch.' 'rebase:Rebase from integration branch.'
'checkout:Checkout local feature branch.' 'checkout:Checkout local feature branch.'
'pull:Pull changes from remote.' 'pull:Pull changes from remote.'
) 'rename:Rename a feature branch.'
_describe -t commands 'git flow feature' subcommands )
_arguments \ _describe -t commands 'git flow feature' subcommands
-v'[Verbose (more) output]' _arguments \
;; -v'[Verbose (more) output]'
;;
(options)
case $line[1] in (options)
case $line[1] in
(start)
_arguments \ (start)
-F'[Fetch from origin before performing finish]'\ _arguments \
':feature:__git_flow_feature_list'\ -F'[Fetch from origin before performing finish]'\
':branch-name:__git_branch_names' ':feature:__git_flow_feature_list'\
;; ':branch-name:__git_branch_names'
;;
(finish)
_arguments \ (finish)
-F'[Fetch from origin before performing finish]' \ _arguments \
-r'[Rebase instead of merge]'\ -F'[Fetch from origin before performing finish]' \
':feature:__git_flow_feature_list' -r'[Rebase instead of merge]'\
;; ':feature:__git_flow_feature_list'
;;
(delete)
_arguments \ (delete)
-f'[Force deletion]' \ _arguments \
-r'[Delete remote branch]' \ -f'[Force deletion]' \
':feature:__git_flow_feature_list' -r'[Delete remote branch]' \
;; ':feature:__git_flow_feature_list'
;;
(publish)
_arguments \ (publish)
':feature:__git_flow_feature_list'\ _arguments \
;; ':feature:__git_flow_feature_list'\
;;
(track)
_arguments \ (track)
':feature:__git_flow_feature_list'\ _arguments \
;; ':feature:__git_flow_feature_list'\
;;
(diff)
_arguments \ (diff)
':branch:__git_branch_names'\ _arguments \
;; ':branch:__git_branch_names'\
;;
(rebase)
_arguments \ (rebase)
-i'[Do an interactive rebase]' \ _arguments \
':branch:__git_branch_names' -i'[Do an interactive rebase]' \
;; ':branch:__git_branch_names'
;;
(checkout)
_arguments \ (checkout)
':branch:__git_flow_feature_list'\ _arguments \
;; ':branch:__git_flow_feature_list'\
;;
(pull)
_arguments \ (pull)
':remote:__git_remotes'\ _arguments \
':branch:__git_branch_names' ':remote:__git_remotes'\
;; ':branch:__git_branch_names'
;;
*)
_arguments \ *)
-v'[Verbose (more) output]' _arguments \
;; -v'[Verbose (more) output]'
esac ;;
;; esac
esac ;;
esac
}
__git-flow-bugfix ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new bugfix branch.'
'finish:Finish a bugfix branch.'
'delete:Delete a bugfix branch.'
'list:List all your bugfix branches. (Alias to `git flow bugfix`)'
'publish:Publish bugfix branch to remote.'
'track:Checkout remote bugfix branch.'
'diff:Show all changes.'
'rebase:Rebase from integration branch.'
'checkout:Checkout local bugfix branch.'
'pull:Pull changes from remote.'
'rename:Rename a bugfix branch.'
)
_describe -t commands 'git flow bugfix' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':bugfix:__git_flow_bugfix_list'\
':branch-name:__git_branch_names'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-r'[Rebase instead of merge]'\
':bugfix:__git_flow_bugfix_list'
;;
(delete)
_arguments \
-f'[Force deletion]' \
-r'[Delete remote branch]' \
':bugfix:__git_flow_bugfix_list'
;;
(publish)
_arguments \
':bugfix:__git_flow_bugfix_list'\
;;
(track)
_arguments \
':bugfix:__git_flow_bugfix_list'\
;;
(diff)
_arguments \
':branch:__git_branch_names'\
;;
(rebase)
_arguments \
-i'[Do an interactive rebase]' \
':branch:__git_branch_names'
;;
(checkout)
_arguments \
':branch:__git_flow_bugfix_list'\
;;
(pull)
_arguments \
':remote:__git_remotes'\
':branch:__git_branch_names'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
} }
__git-flow-config () __git-flow-config ()
{ {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments -C \ _arguments -C \
':command:->command' \ ':command:->command' \
'*::options:->options' '*::options:->options'
case $state in case $state in
(command) (command)
local -a subcommands local -a subcommands
subcommands=( subcommands=(
'list:List the configuration. (Alias to `git flow config`)' 'list:List the configuration. (Alias to `git flow config`)'
'set:Set the configuration option' 'set:Set the configuration option'
) )
_describe -t commands 'git flow config' subcommands _describe -t commands 'git flow config' subcommands
;; ;;
(options) (options)
case $line[1] in case $line[1] in
(set) (set)
_arguments \ _arguments \
--local'[Use repository config file]' \ --local'[Use repository config file]' \
--global'[Use global config file]'\ --global'[Use global config file]'\
--system'[Use system config file]'\ --system'[Use system config file]'\
--file'[Use given config file]'\ --file'[Use given config file]'\
':option:(master develop feature hotfix release support versiontagprefix)' ':option:(master develop feature hotfix release support versiontagprefix)'
;; ;;
*) *)
_arguments \ _arguments \
--local'[Use repository config file]' \ --local'[Use repository config file]' \
--global'[Use global config file]'\ --global'[Use global config file]'\
--system'[Use system config file]'\ --system'[Use system config file]'\
--file'[Use given config file]' --file'[Use given config file]'
;; ;;
esac esac
;; ;;
esac esac
} }
__git_flow_version_list () __git_flow_version_list ()
{ {
local expl local expl
declare -a versions declare -a versions
versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}}) versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return __git_command_successful || return
_wanted versions expl 'version' compadd $versions _wanted versions expl 'version' compadd $versions
} }
__git_flow_feature_list () __git_flow_feature_list ()
{ {
local expl local expl
declare -a features declare -a features
features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted features expl 'feature' compadd $features
}
__git_flow_bugfix_list ()
{
local expl
declare -a bugfixes
features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}}) bugfixes=(${${(f)"$(_call_program bugfixes git flow bugfix list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return __git_command_successful || return
_wanted features expl 'feature' compadd $features _wanted bugfixes expl 'bugfix' compadd $bugfixes
} }
__git_remotes () { __git_remotes () {
local expl gitdir remotes local expl gitdir remotes
gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
__git_command_successful || return __git_command_successful || return
remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]}) remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]})
__git_command_successful || return __git_command_successful || return
# TODO: Should combine the two instead of either or. # TODO: Should combine the two instead of either or.
if (( $#remotes > 0 )); then if (( $#remotes > 0 )); then
_wanted remotes expl remote compadd $* - $remotes _wanted remotes expl remote compadd $* - $remotes
else else
_wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*" _wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*"
fi fi
} }
__git_flow_hotfix_list () __git_flow_hotfix_list ()
{ {
local expl local expl
declare -a hotfixes declare -a hotfixes
hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}}) hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return __git_command_successful || return
_wanted hotfixes expl 'hotfix' compadd $hotfixes _wanted hotfixes expl 'hotfix' compadd $hotfixes
} }
__git_branch_names () { __git_branch_names () {
local expl local expl
declare -a branch_names declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
__git_command_successful || return __git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names _wanted branch-names expl branch-name compadd $* - $branch_names
} }
__git_command_successful () { __git_command_successful () {
if (( ${#pipestatus:#0} > 0 )); then if (( ${#pipestatus:#0} > 0 )); then
_message 'not a git repository' _message 'not a git repository'
return 1 return 1
fi fi
return 0 return 0
} }
zstyle ':completion:*:*:git:*' user-commands flow:'provide high-level repository operations' zstyle ':completion:*:*:git:*' user-commands flow:'provide high-level repository operations'
...@@ -10,22 +10,23 @@ plugins=(... git-flow) ...@@ -10,22 +10,23 @@ plugins=(... git-flow)
## Aliases ## Aliases
More information about `git-flow` commands: More information about `git-flow` commands:
https://github.com/nvie/gitflow/wiki/Command-Line-Arguments https://github.com/nvie/gitflow/wiki/Command-Line-Arguments
| Alias | Command | Description | | Alias | Command | Description |
|---------|---------------------------|----------------------------------------| |---------|----------------------------|----------------------------------------|
| `gfl` | `git flow` | Git-Flow command | | `gfl` | `git flow` | Git-Flow command |
| `gfli` | `git flow init` | Initialize git-flow repository | | `gfli` | `git flow init` | Initialize git-flow repository |
| `gcd` | `git checkout develop` | Check out develop branch | | `gcd` | `git checkout develop` | Check out develop branch |
| `gch` | `git checkout hotfix` | Check out hotfix branch | | `gch` | `git checkout hotfix` | Check out hotfix branch |
| `gcr` | `git checkout release` | Check out release branch | | `gcr` | `git checkout release` | Check out release branch |
| `gflf` | `git flow feature` | List existing feature branches | | `gflf` | `git flow feature` | List existing feature branches |
| `gflh` | `git flow hotfix` | List existing hotfix branches | | `gflh` | `git flow hotfix` | List existing hotfix branches |
| `gflr` | `git flow release` | List existing release branches | | `gflr` | `git flow release` | List existing release branches |
| `gflfs` | `git flow feature start` | Start a new feature: `gflfs <name>` | | `gflfs` | `git flow feature start` | Start a new feature: `gflfs <name>` |
| `gflhs` | `git flow hotfix start` | Start a new hotfix: `gflhs <version>` | | `gflhs` | `git flow hotfix start` | Start a new hotfix: `gflhs <version>` |
| `gflrs` | `git flow release start` | Start a new release: `gflrs <version>` | | `gflrs` | `git flow release start` | Start a new release: `gflrs <version>` |
| `gflff` | `git flow feature finish` | Finish feature: `gflff <name>` | | `gflff` | `git flow feature finish` | Finish feature: `gflff <name>` |
| `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` | | `gflfp` | `git flow feature publish` | Publish feature: `gflfp <name>` |
| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` | | `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` |
| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` |
...@@ -33,8 +33,13 @@ alias gflfs='git flow feature start' ...@@ -33,8 +33,13 @@ alias gflfs='git flow feature start'
alias gflhs='git flow hotfix start' alias gflhs='git flow hotfix start'
alias gflrs='git flow release start' alias gflrs='git flow release start'
alias gflff='git flow feature finish' alias gflff='git flow feature finish'
alias gflfp='git flow feature publish'
alias gflhf='git flow hotfix finish' alias gflhf='git flow hotfix finish'
alias gflrf='git flow release finish' alias gflrf='git flow release finish'
alias gflfp='git flow feature publish'
alias gflhp='git flow hotfix publish'
alias gflrp='git flow release publish'
alias gflfpll='git flow feature pull'
_git-flow () _git-flow ()
{ {
......
# git-hubflow plugin
This plugin adds completion for [HubFlow](https://datasift.github.io/gitflow/) (GitFlow for GitHub), as well as some
aliases for common commands. HubFlow is a git extension to make it easy to use GitFlow with GitHub. Based on the
original gitflow extension for git.
The hubflow tool has to be [installed](https://github.com/datasift/gitflow#installation) separately.
To use it, add `git-hubflow` to the plugins array in your zshrc file:
```zsh
plugins=(... git-hubflow)
```
## Aliases
| Alias | Command | Description |
|-------|------------------|------------------------------------------------------------------|
| ghf | `git hf` | Print command overview |
| ghff | `git hf feature` | Manage your feature branches |
| ghfr | `git hf release` | Manage your release branches |
| ghfh | `git hf hotfix` | Manage your hotfix branches |
| ghfs | `git hf support` | Manage your support branches |
| ghfu | `git hf update` | Pull upstream changes down into your master and develop branches |
#!zsh
#
# Installation
# ------------
#
# To achieve git-hubflow completion nirvana:
#
# 0. Update your zsh's git-completion module to the newest version.
# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
#
# 1. Install this file. Either:
#
# a. Place it in your .zshrc:
#
# b. Or, copy it somewhere (e.g. ~/.git-hubflow-completion.zsh) and put the following line in
# your .zshrc:
#
# source ~/.git-hubflow-completion.zsh
#
# c. Or, use this file as an oh-my-zsh plugin.
#
alias ghf='git hf' alias ghf='git hf'
alias ghff='git hf feature' alias ghff='git hf feature'
alias ghfr='git hf release' alias ghfr='git hf release'
...@@ -97,8 +75,8 @@ __git-hf-release () ...@@ -97,8 +75,8 @@ __git-hf-release ()
'finish:Finish a release branch.' 'finish:Finish a release branch.'
'list:List all your release branches. (Alias to `git hf release`)' 'list:List all your release branches. (Alias to `git hf release`)'
'cancel:Cancel release' 'cancel:Cancel release'
'push:Push release to github' 'push:Push release to GitHub'
'pull:Pull release from github' 'pull:Pull release from GitHub'
'track:Track release' 'track:Track release'
) )
_describe -t commands 'git hf release' subcommands _describe -t commands 'git hf release' subcommands
...@@ -155,8 +133,8 @@ __git-hf-hotfix () ...@@ -155,8 +133,8 @@ __git-hf-hotfix ()
'list:List all your hotfix branches. (Alias to `git hf hotfix`)' 'list:List all your hotfix branches. (Alias to `git hf hotfix`)'
'publish:Publish the hotfix branch.' 'publish:Publish the hotfix branch.'
'track:Track the hotfix branch.' 'track:Track the hotfix branch.'
'pull:Pull the hotfix from github.' 'pull:Pull the hotfix from GitHub.'
'push:Push the hotfix to github.' 'push:Push the hotfix to GitHub.'
'cancel:Cancel the hotfix.' 'cancel:Cancel the hotfix.'
) )
_describe -t commands 'git hf hotfix' subcommands _describe -t commands 'git hf hotfix' subcommands
...@@ -217,8 +195,8 @@ __git-hf-feature () ...@@ -217,8 +195,8 @@ __git-hf-feature ()
'diff:Diff' 'diff:Diff'
'rebase:Rebase feature branch against develop' 'rebase:Rebase feature branch against develop'
'checkout:Checkout feature' 'checkout:Checkout feature'
'pull:Pull feature branch from github' 'pull:Pull feature branch from GitHub'
'push:Push feature branch to github' 'push:Push feature branch to GitHub'
'cancel:Cancel feature' 'cancel:Cancel feature'
) )
_describe -t commands 'git hf feature' subcommands _describe -t commands 'git hf feature' subcommands
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment