16

When I pushed a branch to my remote on github it was giving me the message:

remote: Create a pull request for 'branch-name' on GitHub by visiting:
remote:      https://github.com/repo/pull/new/branch-name

which was really nice to have that clickable link. It is no longer giving me that link, how can I get it back?

tgreen
  • 1,720
  • 1
  • 16
  • 28

2 Answers2

11

This is fairly recent (sept. 2018) and is described as:

When you push a new branch to GitHub from the command line, you’ll now notice a URL within the output which you can copy in order to quickly open a new pull request.

https://user-images.githubusercontent.com/45141/45300188-f6865080-b50d-11e8-9a82-866c9d7e9546.png

So this is when you are pushing a new branch, not when you are pushing new commits to an existing branch.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 3
    I'm not a big fan of this, makes me think something went wrong. Any idea if this can be turned off? – Brandon Bil Oct 28 '18 at 06:58
  • @BrandonBil Not sure: that comes from the remote side, that is GitHub: only their support (https://github.com/contact) can know if there is an option to make that message go away. – VonC Oct 28 '18 at 07:02
  • `https://github.com/$userRepo/compare/$base...$branch?expand=1` will specify the base branch (target) for the PR. (Where are these different URLs defined?) – Joe Bowbeer Mar 26 '19 at 03:30
  • 1
    @JoeBowbeer They are specified by the contributor when he/she defines and make a new PR. – VonC Mar 26 '19 at 07:23
  • 5
    I'm a fan of this message, but I'd like to be able to enable it for every push to a branch. I guess that isn't possible? – zymhan Nov 06 '19 at 19:28
  • @zymhan It doesn't look possible at the moment, since it is only for new branches, not for commits pushed on existing branches. – VonC Nov 06 '19 at 19:30
  • Any idea how to turn it on for github self host? -- and while on the subject, to show the link of the PR if it already exists? – Javier Buzzi Dec 02 '20 at 19:28
  • @JavierBuzzi Considering this URL is created when you are pushing a *new* branch, I doubt the URL would already exist. Regarding GHE (GitHub for Enterprise, the "self-hosted" GitHub instance), I don't know. – VonC Dec 02 '20 at 20:20
  • @JavierBuzzi Found it: https://enterprise.github.com/releases/2.15.0/notes, this is included with GHE 2.15 from Oct. 2018: "Pull request URL is included in the output of a git push." – VonC Dec 02 '20 at 20:24
  • ```So this is when you are pushing a new branch, not when you are pushing new commits to an existing branch.``` Is it possible to show the URL every time you push new commits to your branch as well? – Olshansky Mar 13 '21 at 19:55
  • 2
    @Olshansk Not that I know of. You can display the PR your branch is currently associated with, using [`gh pr view`](https://cli.github.com/manual/gh_pr_view). – VonC Mar 13 '21 at 20:01
  • Gitlab (not Github) will, in every push message, give you a link to create a new PR, or, if one already exists, the link to it. It's simple, intuitive, and a huge timesaver. – entonio Dec 28 '21 at 00:45
  • @ent I agree. From what I wrote above, GitHub does it too, doesn't it? – VonC Dec 28 '21 at 06:29
3

I usually just check out a new branch, and then push the new branch up. Get the URL from the message, and use it create a PR for the new branch. Then, I delete the old one (both local, and remote).

jenlampton
  • 315
  • 2
  • 7