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

Whatever I do i get a "branch is invalid or doesn't exist" #484

Open
dpc opened this issue Dec 11, 2023 · 8 comments
Open

Whatever I do i get a "branch is invalid or doesn't exist" #484

dpc opened this issue Dec 11, 2023 · 8 comments

Comments

@dpc
Copy link

dpc commented Dec 11, 2023

I'm trying to use backport locally for convenient backporting, but no matter what access token I give it I'm hitting:

$ npx backport --commit 516b25067b4bec1d1fb4fc075f85f3415433c767 --sourceBranch 23-12-11-just-backport-commit
repo: fedimint/fedimint

? Select commit chore: backport-commit
? Select branch releases/v0.2

Backporting to releases/v0.2:
✖ Pulling latest changes
The branch "releases/v0.2" is invalid or doesn't exist

Is there a -v flag or something where I could look at what is going on under the hood?

@sorenlouv
Copy link
Owner

Hi there,

What version of backport are you using? Try npx backport --version

@sorenlouv
Copy link
Owner

sorenlouv commented Dec 12, 2023

I think I found the issue. You are trying to backport a commit from the branch 23-12-11-just-backport-commit. This branch doesn't exist.

The error message is currently misleading. i'll add a fix to improve that.

Btw. I tried figuring out on which branch the commit lives, but it looks like it's an orphan:
fedimint/fedimint@516b250

@dpc
Copy link
Author

dpc commented Dec 12, 2023

The branch existed locally in my local repo, as the commit is in a private fork, so I couldn't really point at any upstream PR number. So I started with --commit but that immediately failed, so I tried --sourceBranch my local branch name and I it looked like it is kind of working as it was doing something before it failed at what looked like trying to push, but I guess I just confused myself.

I'd really love some --verbose flag that would print Fetching branch xyz, Checkout out abc, etc. I often work in weird setups and need to bend tools in all sorts of ways and being able to understand the inner-workings is very helpful.

@sorenlouv
Copy link
Owner

I'd really love some --verbose flag that would print Fetching branch xyz, Checkout out abc, etc. I often work in weird setups and need to bend tools in all sorts of ways and being able to understand the inner-workings is very helpful.

There are logs in ~/.backport/backport.info.log and ~/.backport/backport.debug.log. If you have jq installed you can read them like

tail -f ~/.backport/backport.info.log | jq

@sorenlouv
Copy link
Owner

The branch existed locally in my local repo, as the commit is in a private fork, so I couldn't really point at any upstream PR number

The way the backport tool works, is that it clones the repository into a temporary folder, and performans the git operations there. The commit you want to backport therefore needs to be available in the upstream repository - not just locally.

@dpc
Copy link
Author

dpc commented Dec 12, 2023

The way the backport tool works, is that it clones the repository into a temporary folder, and performans the git operations there. The commit you want to backport therefore needs to be available in the upstream repository - not just locally.

Is there any way to backport a PR/commit from a private fork to a public upstream one? Is it something that could be supported?

@sorenlouv
Copy link
Owner

Is there any way to backport a PR/commit from a private fork to a public upstream one? Is it something that could be supported?

I don't think so.
Does Github even support this? If you have a private fork, of a public repo, can you create a pull request on the public repo, that references a change in the private repo? If not, I don't see how this should work.

@dpc
Copy link
Author

dpc commented Dec 13, 2023

Does Github even support this? If you have a private fork, of a public repo, can you create a pull request on the public repo, that references a change in the private repo? If not, I don't see how this should work.

I thought that backport fetches the PR, created a new branch, pushes it somewhere and creates a PR. The only difference in this workflow is that "fetches the PR" comes from some other repo than the original one, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants