0

I base git remote myproject on remote upstream from github. Now I have branch master tracking myproject/master but want to have another branch tracking upstream/master, so I create branch upstream-master.

  • Getting changes from upstream/master is easy, just do git pull upstream when on local/master
  • It is good to have a local branch upstream-master to prepare commits to upstream/master
    • To copy commits from master to upstream-master: git merge master
    • To see pending commits on upstream-master: git log @{upstream}..
    • To automatically squash merge commits and such: git rebase -i @{upstream}

For some reason one cannot automatically push from local/upstream-master to upstream/master. This works:

git co upstream-master
git push upstream HEAD:master

This is ineffective, upstream is not changed

git co upstream-master
git push --set-upstream upstream HEAD:master

This affects local/master

git co upstream-master
git push --set-upstream upstream master

Why is it not possible to configure so that git push wih no arguments pushes from local/upstream-master to upstream/master?

user229115
  • 1,071
  • 7
  • 9
  • 2
    Is [this](http://stackoverflow.com/questions/948354/default-behavior-of-git-push-without-a-branch-specified) what you are looking for? – ckruczek Jul 20 '16 at 05:46
  • What is wrong with doing `git push origin local_master : upstream_master`, or am I missing the point? Have a look [here](http://stackoverflow.com/questions/948354/default-behavior-of-git-push-without-a-branch-specified). – Tim Biegeleisen Jul 20 '16 at 05:46
  • Does this answer your question? [How do I push a local Git branch to master branch in the remote?](https://stackoverflow.com/questions/5423517/how-do-i-push-a-local-git-branch-to-master-branch-in-the-remote) – Tom Hale Jun 30 '23 at 13:49

0 Answers0