gitbutler icon indicating copy to clipboard operation
gitbutler copied to clipboard

Failed to create virtual branch from branch

Open mxmilkiib opened this issue 1 year ago • 4 comments

So for reasons I removed a repo directory and recloned it. I loaded into Git Butler again, then I tried to "Apply" my previous remote PR branch, but recieved the error message "Failed to create virtual branch from branch". I then used gh pr checkout [num] to get the PR branch local, and then tried to Apply it in the UI but to the same result. I then did touch test so there was some difference in the workspace, so as to give the columns, then tried to Apply, but to the same result.

Am I missing a step or such here? Or could Git Butler do something differently to make this work? Thanks!

mxmilkiib avatar Mar 24 '24 21:03 mxmilkiib

Judging from my own experience, the way commits are currently displayed in a remote workflow can be confusing and in #3121 there is ongoing work to improve that display. With such overhaul, I would expect this behaviour to improve and become more intuitive.

In the meantime, when that happens again, maybe you could share the errors from the application logs. Thank you.

Byron avatar Apr 23 '24 11:04 Byron

This issue is the first google hit for gitbutler gh pr checkout.

When doing gh pr checkout [num], gitbutler now says:

Due to GitButler managing multiple virtual branches, you cannot switch back and forth between git branches and virtual branches easily.

The linked documentation (https://docs.gitbutler.com/features/virtual-branches/integration-branch) does not have any hint on how to work on pull requests of other contributors.

I would love to do gh pr checkout [num] and then working with git butler on that base. Maybe, this refs https://github.com/gitbutlerapp/gitbutler/issues/4578?

koppor avatar Aug 02 '24 12:08 koppor

In theory, once gh pr checkout was run, there should be a new local branch tracking the branch on the remote repository from which the PR was created. That local branch should be suitable to bring into the workspace for edits. What's missing from there is the ability to actually interact with the underlying PR, or work with the underlying remote.

I would love to do gh pr checkout [num] and then working with git butler on that base. Maybe, this refs #4578?

Maybe stacked virtual branches can also be used for that, but key here would be that the remote configuration of Git itself is respected.

Byron avatar Aug 03 '24 06:08 Byron

In theory, once gh pr checkout {num} was run, there should be a new local branch tracking the branch on the remote repository from which the PR was created.

Yeah! Currently, with 0.12.16, I get "Looks like you've switched away from gitbutler/integration". (I think, this is understandable, because the gh command leads to a checkout of a branch.)

koppor avatar Aug 04 '24 06:08 koppor