FredrikNoren / ungit

The easiest way to use git. On any platform. Anywhere.
MIT License
10.45k stars 638 forks source link

Upstream branch not set when pushing new branch to remote #1335

Open jkuester opened 4 years ago

jkuester commented 4 years ago

Maybe I am missing some configuration on my end, but this does not seem to work how I would expect. I expected that when I pushed a new local branch to a remote, the "upstream" for the local branch would be set to the new remote branch. This will allow me to run a simple git pull command to pull changes from the remote.

When using the normal git CLI you can achieve this with the git push -u command. So, for example, the following sequence of commands succeeds:

git checkout -b test
git push -u
git pull

However if I use Ungit to push the branch to the remote (via the push button), and then I try and run git pull from the cli, I get the following error:

λ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> test

Setting the upstream branch when pushing a new branch to the remote would be really helpful particularly when using Ungit in combination with other git clients (e.g. the normal git cli, IDE clients, and/or scripts. In my case the offending program is the IntelliJ IDEA. If I try to use IntelliJ's built-in git client to pull the latest changes from the remote (after I pushed the branches via Ungit) I get the error mentioned above.

jkuester commented 4 years ago

This seems related to https://github.com/FredrikNoren/ungit/issues/1037, but not exactly the same....

ylecuyer commented 4 years ago

I was going to say this bothers me since I started using ungit, then I saw that past me already created #1037 which you mentioned ^^