desktop: unable to checkout remote branch when existing local branch has the same name
Hi,
first of all, thanks for this nice tool.
I am getting this error message A branch with that name already exists. (as shown in the attchement) , when I click on Other branches , which are branches that do not appear anyway with git ls-remote – not sure if this is related to #2964
Thanks for your help.
ps: I am using v 1.1.1 on mac os 10.13.4
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 40
- Comments: 52 (12 by maintainers)
Can this get fixed already?
Waiting…
This still seems to be unresolved 😢
Taking this a step further, rather than introducing a magic convention here would it be helpful to explain the problem and let the user choose what to name the branch (with a sane default)?
The words in here are just something I threw together in haste, but I wanted to demonstrate the flow that might help address the bug and better support users working with multiple remotes.
I am…sorely disappointed. Over three years and still unfixed says it is never going to get fixed, and this bug is a very big annoyance when working on some team projects.
I have avoided using a GUI git client for years as I feel very familiar with the CLI interface on *nix systems, but I’m currently updating a repo (a fork of another user’s primary origin) on a Windows system and thought I would give this official client a try in order to manage this repo here. Running into this bug within thirty seconds of installing the client and then discovering it hasn’t been fixed for over four years leaves an appalling first impression. Software with bugs of this severity, regularly encountered by users following bog-standard workflows, should be considered abandoned and it’s inappropriate to promote them as actively supported software on the site.
I think you really need to reconsider what “core functions” are… Checking out a remote branch is a major function, and it should be high priority.
I was searching for good git client for my teammates.
So I gave a try to Desktop Github, to discover that I could not switch to my upstream whereas it is thanks to github that I learnt git by forking and having an upstream.
Seriously, the bug was opened since almost 3 years and it is not resolved: SHAME !! whereas it is a basic github workflow, this is a joke 😂
I do not care about command lines workaround as I am searching a UI client. Since I know git, I am waiting for a decent git UI but it seems that it is not today
Less wait again few years…
Use Fork or GitKraken instead 🤣
@ArjixWasTaken is right. I cannot check out upsteam/dev, so I’m unable to merge one of the most important branches of the original repo that I am contributing to with the client. That is pretty core to me.
dear god will this ever get fixed, it’s been 4 years
Recently downloaded this GUI, and now I’m here because of this issue. WOW! 6 years still a problem when using multiple remotes? Is this project abandoned?
I explored this a bit and decided to put it down for now in favor of other work. I’ll do a brain dump here in order to capture what I thought about and discovered.
Proposed solution
Say we’ve forked a repo, open it in Desktop (using the “Clone or download” button), and click “Fetch origin” to ensure that the remote branch refs have been fetched.
In the branch list we see
masterwhich tracks withorigin/master. And under “Other Branches” we seeupstream/master.Right now, this
upstream/masteris not actually referring to a local branch. It’s referring to a remote branch that Git uses to track where the remote branch tip is (presumably output fromgit branch --remote).Currently when the user clicks this Desktop tries to create another branch called
master, which fails because we of course already have a branch calledmaster.Ideally, when the user clicks this, Desktop will detect that there’s a clash in branch name and create a new local branch called
upstream/masterand set up the proper remote tracking info for this branch.Under the hood, Desktop could run
git checkout -b upstream/master remotes/upstream/masterand this would produce the following config settings:Now when the user checks the branch list they should see
upstream/masterin their “Recent branches” list.Considerations
Note: Currently if I run
git checkout -b upstream/master remotes/upstream/masteron the command line, for some reason Desktop displaysheads/upstream/masterin the “Other Branches” list, and when clicked on the app puts you in detached head state. It’s not immediately clear to me why this happens. Interestingly if I name the branch upstream-master then it shows up just fine and works as expected.Another consideration to keep in mind is – if a user clicks a branch corresponding to an upstream remote branch that doesn’t have a local branch name that conflicts, Desktop currently creates a local branch for it that does not have any
upstreamprefix. This inconsistency could be confusing… Here’s an example to illustrate: say we have branches on our upstream remote calledmasterandgiraffe. If a user clicks theupstream/masterremote branch in the list then, because there’s already a localmasterbranch corresponding toremotes/origin/master, they’d end up with aupstream/masterlocal branch that tracks theremotes/upstream/masterbranch. If they clickupstream/giraffeand there is not already a local branch with that name, they’ll get agiraffelocal branch that tracks theremotes/upstream/giraffebranch.Also worth noting, the Desktop team discussed prompting the user for the branch name they would like to use when there’s a naming conflict (per @shiftkey’s suggestion here). We are leaning towards a more behind-the-scenes approach in order to spare users potential confusion if they’re unaware of what the clash means or why it’s happening. And we imagine that a vast majority of cases where this is an issue, a user is using a forking workflow and trying to see what’s on
upstream/master, so we can simply create a new branch calledupstream/masteror them to be able to do so (but of course generalize this to<remote-name>/<branch-name>). This would spare users some unnecessary mental cycles, and perhaps spare newer folks some confusion or intimidation.Another thing that’d greatly simplify things (and cover 95% of my use cases with remote branches) if I was able to select some other branch from this dialog (new branch):
I can’t see the reason for why there are only 2 choices. There should be a way to select arbitrary branch that you can see in branches drop-down. And that way, I’d be able to branch from remote/branch without actually checking it out into some separate local branch (I did it via command line so I don’t see why It can be added to the interface).
Used the workaround mentioned by @shiznit304 Its in top toolbar of GUI under “Branch”
then “compare to branch”
Use the work around
On Fri, Sep 23, 2022 at 8:38 AM Dirty Gooback @.***> wrote:
Just ran into this. +1 please fix thank you
Currently I use the following workaround: switch to console/shell and checkout
remote/branchmanually (that works fine), when branch from that. Hopefully it’ll be automated soon.