2016-07-29 90 views
1

我怎樣才能一次性刪除我的一些Git窗口?我在sourceTree中嘗試過,但似乎我一次只能刪除一個存儲。我可以同時刪除其中的幾個嗎?有沒有在git bash中執行此操作的命令?我不想刪除所有這些。如何將批量刪除?

回答

3

使用bash Brace Expansion,我們可以快速創建藏匿的一個長長的清單,例如,[email protected]{8} [email protected]{7} [email protected]{6} [email protected]{5} [email protected]{3} [email protected]{1}

可以echo [email protected]\{{8..5}\} [email protected]\{{3,1}\}

xargs,或for環放在一起進行,我們得到:

echo [email protected]\{{8..5}\} [email protected]\{{3,1}\} | xargs -rn1 git stash drop 

注意:該列表必須顛倒。

1

這應該這樣做:

echo -e '[email protected]{6}\[email protected]{3}\nstash' | xargs -rl git stash drop 

但要確保爲命令執行一前一後,以「倒計時」,如果你在我的例子中使用數字參考就像每個命令後,indizes將轉移所以從最老的開始。當然也可以用你在救人時給的名字。