Skip to content

Loading…

Remote url when checking out branch #576

Closed
rejeep opened this Issue · 7 comments

2 participants

@rejeep

Hi,

In a recent update of Magit, the remote user changed when checking out a new remote branch, so:

  • I got a pull request
  • I did f a (since that user repo was already added)
  • I did b b to check out that branch locally

This is the output:

$ git --no-pager checkout -b hide-steps-for-successful-scenarios refs/remotes/magnars/hide-steps-for-successful-scenarios
Switched to a new branch 'hide-steps-for-successful-scenarios'
Branch hide-steps-for-successful-scenarios set up to track remote branch hide-steps-for-successful-scenarios from magnars.

In magit it looks like this:

Remote:   hide-steps-for-successful-scenarios @ magnars (https://github.com/magnars/ecukes.git)
Local:    hide-steps-for-successful-scenarios ~/Code/ecukes/
Head:     8f7f565 Hide steps for successful scenarios

As you can see, the remote url is https://github.com/magnars/ecukes.git. It has always before been https://github.com/rejeep/ecukes.git (magnars => rejeep).

Why is this?

@dudebout
Magit member

I do not know how pull requests appear but I do not see any inconsistency in what you have pasted.

You checked out a branch in refs/remotes/magnars and it is therefore tracking magnars. Why is that unexpected?

@rejeep

This is how I noticed it. I wanted to check out a remote pull request branch, make a change and push it to my origin repo.

  • Add remote host
  • Fetch f a
  • Checkout b b
  • Make change
  • Push P P

But now when I push, it will be the remote repo, not my origin. Has this been changed or am I drunk?

@dudebout
Magit member

Where do pull requests appear? If they appear in your repo what you say should work. You pull from your repo so the upstream is your repo.

However, from the "trace" you gave it seems that you grabbed the pull request directly from magnars remote instead of taking it from the pull request in your own repo. In which case the branch's upstream is magnars.

@dudebout
Magit member

If my last comment does not answer your question please do a quick pull request to http://github.com/dudebout/foo so that I can see what they look like from the other side ;-)

@rejeep

Where do pull requests appear? If they appear in your repo what you say should work. You pull from your repo so the upstream is your repo.

Since I have to add the remote repo, I would say they do not live in my repo.

(I made a PR to foo)

@dudebout
Magit member

Thanks for the PR. From the email I received

You can merge this Pull Request by running

  git pull https://github.com/rejeep/foo master

it is clear that the pull request (in your case) lives in magnars.

From that point you have two ways of testing the PR:

  • create a new branch, in which case it will be following magnars
  • merge it in a branch you already have that is following rejeep

Are you sure you did not use the other method in the past? If not, I cannot explain the change in behavior.

@rejeep

Sound reasonable. Since I cant say exactly what changed, I'm closing this and reopen if I have a more detailed problem description.

Thanks for the help!

@rejeep rejeep closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.