2012-01-17 7 views

cevap

2

Bu benim yaptığım zaman, benim için çalışıyor:

  1. wget http://www.triquanta.nl/sites/default/files/git-flow.bash
  2. kaynak git-flow.bash
  3. takma f = 'git akış özelliği'
  4. tam -F __git_flow_feature
  5. f
  6. f sekmesisekme

neyse, için en yaygın nedeni

if [ 1 = $MYVAL ] 

ve sizin MYVAL ayarlı değil: hata gibi kabuk komut dosyası kodunda olması "[: 1 tekli operatör beklenen". Tamamlama fonksiyonlarınızı kontrol edin. Hata ayıklamak için set -x'u ekleyebilirsiniz.

Genellikle kolay çözüm operatör boş argüman alacak böylece değişken alıntı yapmak, ancak argümanlar doğru sayıda sahip olacak: Ben de bu sorun vardı ve her Google arama beni geri kurşun

if [ 1 = "$MYVAL" ] 
+1

için repo en ikilileri kopyalamak :

wget -O ~/.git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash wget -O ~/.git-flow-completion.bash https://raw.githubusercontent.com/petervanderdoes/git-flow-completion/develop/git-flow-completion.bash 

Git sayıdır burada kaydetti – Daenyth

2

bu gönderi.

Ben Michal'ın cevabı ve Daenyth yorumuna kullanarak bulundu çözüm ilanıyla

...

My git-flow.bash aynıydı ama bizim git tamamlama dosyaları değişen olabileceğini düşünüyorum.

# __git_find_on_cmdline requires 1 argument 
__git_find_on_cmdline() 
{ 
local word subcommand c=1 
while [ $c -lt $cword ]; do 
    word="${words[c]}" 
    for subcommand in $1; do 
     if [ "$subcommand" = "$word" ]; then 
      echo "$subcommand" 
      return 
     fi 
    done 
    c=$((++c)) 
done 
} 

Yeni:

# __git_find_on_cmdline requires 1 argument 
__git_find_on_cmdline() 
{ 
local word subcommand c=1 
while [[ $c -lt $cword ]]; do 
    word="${words[c]}" 
    for subcommand in $1; do 
     if [ "$subcommand" = "$word" ]; then 
      echo "$subcommand" 
      return 
     fi 
    done 
    c=$((++c)) 
done 
} 

Bildirim ben eklemek zorunda çift braket

benim git tamamlama dosyası /etc/bash_completion.d/git

Eski bulunan değiştirmek vardı Bunu düzeltmek için yeni kod. Yaptığım tek değişiklik buydu.

+0

benim için çalışmadı, hala aynı hata ile [: 1: tekli operatör bekleniyor – decebal

2

Neden sadece git-flow-completion kullanıyorsunuz? bash için talimatlar verilmiştir:

$ cd /etc/bash_completion.d 
$ sudo wget https://raw.githubusercontent.com/bobthecow/git-flow-completion/master/git-flow-completion.bash 
$ exec $SHELL 

da zsh veya fish için talimatlar vardır.

alias gn="git-number" 
alias gb="gn -c git blame" 
alias ge="gn -c $EDITOR" 
alias ga="gn add" 
alias gr="gn -c git reset" 
alias gap="EDITOR='$EDITOR -w' gn add -p" 
alias gd="gn -c git diff -b -w --ignore-blank-lines" 
alias gds="gd --staged" 
alias gc="gn -c git checkout" 
alias gcf="git flow feature checkout" 
alias gl="gn -c git log -w -b -p --ignore-blank-lines" 
alias gls="git log --stat" 
alias cm="EDITOR='$EDITOR -w' git commit" 
alias grb="git stash save 'REBASE' && EDITOR='$EDITOR -w' git rebase -i" 
alias grbc="EDITOR='$EDITOR -w' git rebase --continue" 

gcd() { 
    test -n "$1" && cd $(dirname $(git list $1)) 
} 

source ~/.git-completion.bash 
__git_complete gn _git 
__git_complete ga _git_add 
__git_complete gap _git_add 
__git_complete gd _git_diff 
__git_complete gds _git_diff 
__git_complete gc _git_checkout 
__git_complete gcf _git_checkout 
__git_complete gl _git_log 
__git_complete gls _git_log 
__git_complete cm _git_commit 

source ~/.git-flow-completion.bash 

Ve completion komut dosyalarını yüklemek: o bash olduğu için https://github.com/holygeek/git-number Sadece ~/bin

1

Bu takma adları var , [`yerine [[` kullanın. Daha akıllı
İlgili konular