2017-05-05 / @syui

git

git-sh

gitshというものがあるのですが、zshではそれを使わなくても以下のような感じでいけます。

https://github.com/thoughtbot/gitsh

http://pocke.hatenablog.com/entry/2015/12/09/000000

function git-sh()
{
  eval "__precmd_for_git-sh() { print -z '$* ' }"
  autoload -Uz add-zsh-hook
  add-zsh-hook precmd "__precmd_for_git-sh"
}  
$ git-sh git
$ git status

ただ、注意点としてはzshではx-xという形式だと空白でもコマンドを発行できるので、思わぬ結果を招くことも。

/path/to/git-ci

git commit -m "$*"

上記は、こんな感じで便利に使える場合もあります。

# git commit -m "add : commit message!"
# ↓
$ git ci add : commit message!

ちなみにfishやるなら以下のような感じ。--descriptionは補完に使う事が多い。但し、そのままでは使えない。

function git --description 'ci'
	if test (count $argv) -ge 2
		git commit -m "$argv[2..-1]"
	end
end

というか、今度、特定のタグがついた時、本サイトのまとめ記事に追加する仕組み作ろう…。