2015-11-07 50 views
3

我想遞歸清除/重置目錄中的所有git存儲庫。git別名清理/重置目錄中的所有存儲庫

如果我執行下面的命令它按預期工作:

find . -name .git -type d -execdir sh -c "git clean -xdf" \; 

我有問題命令轉換到一個Git別名:

xxx = "!f() { find . -name .git -type d -execdir sh -c "git clean -xdf" ; ; }; f; " 

我試圖修正錯誤,如syntax error near unexpected token ;'`但是我正在一個沒有成功的圈子裏。

請幫我創建別名。 10X

回答

4

在這裏你去:

xxx = "!f() { find . -name .git -type d -execdir git clean -xdf \\; ; }; f" 

有幾件事情:

  • 沒有必要sh -c包的命令,你可以直接使用它
  • 你一定要逃逸的\\;find命令的末尾,寫爲:\\;
+0

非常感謝! – mynkow

相關問題