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

New branch track upstream is the same as the branch that did the checkout from #3675

Open
gabriGutiz opened this issue Jun 18, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@gabriGutiz
Copy link

gabriGutiz commented Jun 18, 2024

Describe the bug
When creating a new branch from a remote one, the new branch remote track is the same as the old one.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Remote branch panel
  2. Hit 'n' to checkout
  3. Choose a name with the same 'feature/' prefix
  4. Hit 'P' to push origin
  5. Pushes to the old branch

Expected behavior
When pushing to the new branch, should ask the remote upstream branch instead of pushing to the old branch.

Screenshots
image

For context: feature/CAN-4068 is the remote branch I did the checkout from.

Version info:
commit=6fcb7eb8bb616c170506312870b3bf15f3dbe37c, build date=2024-05-19T10:15:28Z, build source=binaryRelease, version=0.42.0, os=windows, arch=amd64, git version=2.45.0.windows.1
git version 2.45.0.windows.1

@gabriGutiz gabriGutiz added the bug Something isn't working label Jun 18, 2024
@gabriGutiz gabriGutiz changed the title New branch remote head is the same as the branch that did the checkout from New branch track upstream is the same as the branch that did the checkout from Jun 18, 2024
@mark2185
Copy link
Collaborator

You can unset the upstream from the menu under u.

The default behavior is that the local branch tracks the upstream, which is nifty for most use cases.

@gabriGutiz
Copy link
Author

I was able to change the upstream, but in my case makes more sense to not set the upstream. I want to make a task based on a teammate's change without changing his branch.

Is that a way to change this default behavior locally?

@stefanhaller
Copy link
Collaborator

I think I would be fine with changing the n command to not automatically track the remote branch. I find it unlikely that people want to create a branch with a different name that still tracks the remote branch; and for creating a branch with the same name that tracks the remote branch, they can use space instead.

@gabriGutiz In the meantime, a workaround is to hit enter on the remote branch to see its commits, and then hit n on the head commit; this will create a local branch that doesn't track anything.

@gabriGutiz
Copy link
Author

gabriGutiz commented Jun 18, 2024

Thanks, @stefanhaller! I'll use this workaround so on.

Just adding that I agree with what you said, It's a little annoying that I have to delete the upstream to not make a mess by mistake or do what you described!

Thanks for the attention!!

@jesseduffield
Copy link
Owner

I think I would be fine with changing the n command to not automatically track the remote branch. I find it unlikely that people want to create a branch with a different name that still tracks the remote branch; and for creating a branch with the same name that tracks the remote branch, they can use space instead.

I agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants