git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: Simple shortcut for "git push --set-upstream origin newBranchName"

From
CSCliff Schomburg <clisc@microsoft.com>
Date
Jun 3, 2019, 21:34 UTC
Message-ID
<BN8PR21MB11569B2A49F0ACB69E883458B7140@BN8PR21MB1156.namprd21.prod.outlook.com>
In-Reply-To
<BN8PR21MB1156D785177A40EA7D8341ABB7190@BN8PR21MB1156.namprd21.prod.outlook.com>
So I gave this a try and it seems not to be behaving as expected:
>git push -u

fatal: The current branch {branchName} has no upstream branch. To push the current branch and set the remote as upstream, use

    git push --set-upstream origin {branchName}
I'm using Git for Windows in a Windows CMD prompt, if that matters at all.

Thanks,m Cliff

-----Original Message-----
From: Cliff Schomburg 
Sent: Friday, May 31, 2019 11:13 AM
To: Patryk Obara <dreamer.tan@gmail.com>; git@vger.kernel.org
Subject: RE: Simple shortcut for "git push --set-upstream origin newBranchName"
Thanks, Patryk.  It's always nice to see the feature I want is already implemented!  😊
-----Original Message-----
From: Patryk Obara <dreamer.tan@gmail.com> 
Sent: Friday, May 31, 2019 11:05 AM
To: Cliff Schomburg <clisc@microsoft.com>; git@vger.kernel.org
Subject: Re: Simple shortcut for "git push --set-upstream origin newBranchName"
On 31/05/2019 16:56, Cliff Schomburg wrote:
Show 7 quoted lines
> Wow, I did not see that in the man pages... but I see it now.  Thanks!
> 
> So I guess I would change my ask to this:
> 
> "git push -u"
> 
> Should default to "origin branch" if no parameters are provided.
I think most people will agree, considering it already works this way :)
The default behaviour of git push changed in Git 2.0, perhaps you were reading some old tutorial. You can configure it to match your preferences by changing push.default value in your git config:
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit-scm.com%2Fdocs%2Fgit-config%23Documentation%2Fgit-config.txt-pushdefault&amp;data=02%7C01%7Cclisc%40microsoft.com%7Cf52d699c3fc149d20de508d6e5d96a4c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636949119289770838&amp;sdata=K2NezwOWzZrqsU7l8GybjbJuwmRnC2llT77UhvF%2B8RU%3D&amp;reserved=0

-- Patryk Obara

Previous: Cliff SchomburgNext: Denton Liu
Message 6 of 7 in “RE: Simple shortcut for "git push --set-upstream origin newBranchName"”
  1. Cliff SchomburgMay 31, 2019
  2. Patryk ObaraMay 31, 2019
  3. Cliff SchomburgMay 31, 2019
  4. Patryk ObaraMay 31, 2019
  5. Cliff SchomburgMay 31, 2019
  6. Cliff SchomburgJun 3, 2019
  7. Denton LiuMay 31, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.