2
如果我鍵入以下到終端我可以完成我想要的一切:如何爲git commit,git pull,git push和pull在遠程服務器上創建bash或zsh別名?
git commit -am "my commit message" ; git pull ; git push ; ssh [email protected] 'cd /path/to/git/repo/ ; git pull ; exit'
我想創建相同的別名在我~/.zshrc
。喜歡的東西:
alias pushit() { git commit -am "[email protected]" ; git pull ; git push ; ssh [email protected] 'cd /path/to/git/repo/ ; git pull ; exit' }
要在終端像這樣運行:
pushit "my commit message"
我每次重裝時間
而是〜/ .zshrc(source ~/.zshrc
),或通過我的別名打開一個新的終端窗口我看到它循環幾十次。目前尚不清楚它實際運行。
我在做什麼錯?
注:
- 這不是一個關鍵任務服務器。這只是供個人使用。我知道這是糟糕的形式。
- 我寧可不使用git的[別名]工具,這樣我就可以將所有別名保留在同一個地方(
~/.zshrc
)。