を追跡し続け、私の枝は、デフォルト追跡することによりあると私はgit push -u origin branch_name
を行う場合でも、私は私のpush.default
オプションとしてmatching
を使用している場合でも、リモート・マスターにプッシュします。支店が最近開始マスター
# --------
# STEP 1
# --------
$ git checkout -b my_branch
Branch my_branch set up to track local branch master.
Switched to a new branch 'my_branch'
# --------------------------------------------------------------------------------
# STEP 2: (same behavior BTW with current/upstream/simple)
# --------------------------------------------------------------------------------
$ git config --global push.default matching
# --------
# STEP 3:
# --------
$ git push -u origin my_branch
Counting objects: 8, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 1.16 KiB | 0 bytes/s, done.
Total 8 (delta 7), reused 0 (delta 0)
To XX:YYY/my_repo
62d390c..4e4baa1 my_branch -> master
Branch my_branch set up to track remote branch master from origin.
私はSTEP 2
ために次のことをしようとした場合にも、私はエラーを取得する:
$ git branch --set-upstream-to=origin/my_branch
error: the requested upstream branch 'origin/my_branch' does not exist
hint:
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint:
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.
私は手動で.git/config
を編集することができます知っているが、WHYは、上記の作業をしません?
$ git remote -v
origin XX:YYY/my_repo (fetch)
origin XX:YYY/my_repo (push)
$ git --version
git version 2.9.2
プッシュの後に 'git fetch'を実行しましたか?私はそれが 'origin/my_branch'を作ると思うでしょう。 – selfthinker