Hey, I have a repository in which I track two remotes. Let's call them 'upstream1' and 'upstream2'. My local master branch tracks upstream1/master, while there's a second local branch called u2-master that tracks upstream2/master.
Whenever I have u2-master checked out and use magit's push function magit pushes the local branch u2-master to the remote upstream2 as u2-master and not as master even though a normal 'git push' without further arguments does the 'right thing' -- it pushes the local u2-master to the master branch of the upstream2 remote. Here's how to set up the test case: ------------------------------------------------------------ [0 mbun...@ls-bs-ws14 ~/tmp/magit-push-test] mkdir upstream1 [0 mbun...@ls-bs-ws14 ~/tmp/magit-push-test] cd upstream1 [0 mbun...@ls-bs-ws14 ~/tmp/magit-push-test/upstream1] git init Initialized empty Git repository in /home/mbunkus/tmp/magit-push- test/upstream1/.git/ [0 mbun...@ls-bs-ws14 ~/tmp/magit-push-test/upstream1] echo hello world > info.txt [0 mbun...@ls-bs-ws14 ~/tmp/magit-push-test/upstream1] git add info.txt [0 mbun...@ls-bs-ws14 ~/tmp/magit-push-test/upstream1] git commit -m 'Test' Created initial commit b173303: Test 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 info.txt [0 mbun...@ls-bs-ws14 ~/tmp/magit-push-test/upstream1] cd .. [0 mbun...@ls-bs-ws14 ~/tmp/magit-push-test] git clone --bare file://`pwd`/upstream1 upstream2 Initialized empty Git repository in /home/mbunkus/tmp/magit-push- test/upstream2/ remote: Counting objects: 3, done. remote: Total 3 (delta 0), reused 0 (delta 0) Receiving objects: 100% (3/3), 229 bytes, done. [0 mbun...@ls-bs-ws14 ~/tmp/magit-push-test] git clone file://`pwd`/upstream1 work Initialized empty Git repository in /home/mbunkus/tmp/magit-push- test/work/.git/ remote: Counting objects: 3, done. remote: Total 3 (delta 0), reused 0 (delta 0) Receiving objects: 100% (3/3), done. [0 mbun...@ls-bs-ws14 ~/tmp/magit-push-test] cd work [0 mbun...@ls-bs-ws14 ~/tmp/magit-push-test/work] git remote add upstream2 file://$HOME/tmp/magit-push-test/upstream2 [0 mbun...@ls-bs-ws14 ~/tmp/magit-push-test/work] git fetch upstream2 From file:///home/mbunkus/tmp/magit-push-test/upstream2 * [new branch] master -> upstream2/master [0 mbun...@ls-bs-ws14 ~/tmp/magit-push-test/work] git branch u2-master upstream2/master Branch u2-master set up to track remote branch refs/remotes/upstream2/master. [0 mbun...@ls-bs-ws14 ~/tmp/magit-push-test/work] git checkout u2-master Switched to branch "u2-master" ------------------------------------------------------------ Now start emacs, edit the file, commit, and push. Magit will push to upstream2/u2-master creating a new branch in the remote repository: ------------------------------------------------------------ $ git --no-pager push -v upstream2 u2-master Pushing to file:///home/mbunkus/tmp/magit-push-test/upstream2 Counting objects: 5, done. Unpacking objects: 100% (3/3), done. To file:///home/mbunkus/tmp/magit-push-test/upstream2 * [new branch] u2-master -> u2-master updating local tracking ref 'refs/remotes/upstream2/u2-master' Git finished. ------------------------------------------------------------ Like I said, 'git push' does the right thing: ------------------------------------------------------------ [0 mbun...@ls-bs-ws14 ~/tmp/magit-push-test/work] git add info.txt [0 mbun...@ls-bs-ws14 ~/tmp/magit-push-test/work] git commit -m 'test2' Created commit 4548221: test2 1 files changed, 2 insertions(+), 0 deletions(-) [0 mbun...@ls-bs-ws14 ~/tmp/magit-push-test/work] git push Counting objects: 5, done. Writing objects: 100% (3/3), 263 bytes, done. Total 3 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. To file:///home/mbunkus/tmp/magit-push-test/upstream2 9bccb7b..4548221 u2-master -> u2-master ------------------------------------------------------------ magit obviously does not parse the 'branch.<branchname>.merge' config value which git itself uses for pushs and pulls. Regards, Mosu -- If Darl McBride was in charge, he'd probably make marriage unconstitutional too, since clearly it de-emphasizes the commercial nature of normal human interaction, and probably is a major impediment to the commercial growth of prostitution. - Linus Torvalds
signature.asc
Description: This is a digitally signed message part.
