1

私はgitバージョン1.7.7.5を使用しています。

1 つの git コマンドを使用して次のことを行うことは可能ですか?

git fetch git@github.com:someone/repo.git someones_branch
git checkout FETCH_HEAD -b my_testing_branch
4

1 に答える 1

2

my_testing_branch の上流ブランチを設定できることに注意してください

git branch --set-upstream my_testing_branch someone/someone_branch

(ここでは「someone」という名前のリモートを使用)

そして、単純にそれを git pull します(ただし、それでも必要です:git checkout my_testing_branch+ git pull

あなたの質問に答えるには、git エイリアスを定義するのが 1 つの方法です。

git config --global alias.fetch-github '"!f() { git fetch git@github.com:$1/$2.git $3 ; git checkout FETCH_HEAD -b $4 }; f"'

次のように使用します。

git fetch-github someone repo someone_branch my_testing_branch
于 2012-06-26T06:22:55.913 に答える