Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git hub pull new should set tracking branch #266

Open
nomeata opened this issue Apr 18, 2019 · 9 comments
Open

git hub pull new should set tracking branch #266

nomeata opened this issue Apr 18, 2019 · 9 comments
Labels
type-breaking This is a breaking change, so it should go to the next major version type-enhancement
Milestone

Comments

@nomeata
Copy link

nomeata commented Apr 18, 2019

My workflow is

  • git switch master && git pull
  • git switch -c my_new_branch (or git branch -m my_new_branch)
  • git hub pull new

at this point, git hub creates a new branch fork/my_new_branch. But it does not set it as the tracking branch (i.e. git push -u fork my_new_branch), which means I can’t just update the branch with git push, and I always have to run git push -u fork HEAD.

I wonder if git hub could not do that automatically (at least if no other tracking branch is present).

@leandro-lucarella-sociomantic leandro-lucarella-sociomantic added this to the Future milestone Apr 18, 2019
@leandro-lucarella-sociomantic leandro-lucarella-sociomantic added type-breaking This is a breaking change, so it should go to the next major version type-enhancement labels Apr 18, 2019
@leandro-lucarella-sociomantic

This comment has been minimized.

@nomeata

This comment has been minimized.

@llucax
Copy link
Member

llucax commented Mar 31, 2021

This should not happen if you have a "triangular workflow" set up (the default in the tool for quite some time now), as all pushes should go to your fork by default (git config remote.pushDefault).

Also, so far we've been driving the configuration in the opposite direction (except for the setup command, which clearly set things up). The tool will look at your config to figure out how to behave. Right now the tracking branch is even expected to point to the upstream repo, not your fork, assuming you'll use git pull to update your pull request with the current base branch changes, as it is used to infer the base branch for new pull requests.

One solution to your problem would be changing your workflow ( 😬 ) and do this instead:

git switch master && git pull
git switch -tc my_new_branch

(note the extra -t). I think it should set the tracking branch as you want it.

I don't have a much better answer for now, all this stuff is very workflow-dependent and different people have different workflows.

One thing we could do to support more workflows and would be a low-hanging fruit is to add an option to make git-hub pull new set the tracking branch.

@nomeata

This comment has been minimized.

@llucax

This comment has been minimized.

@nomeata

This comment has been minimized.

@llucax

This comment has been minimized.

@llucax

This comment has been minimized.

@llucax

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-breaking This is a breaking change, so it should go to the next major version type-enhancement
Projects
None yet
Development

No branches or pull requests

3 participants