From: Felipe Contreras <felipe.contreras@gmail.com>
To: Mathias Kunter <mathiaskunter@gmail.com>, git@vger.kernel.org
Subject: RE: git push doesn't use local branch name as default
Date: Thu, 27 May 2021 14:51:46 -0500 [thread overview]
Message-ID: <60aff85261fcf_26530208a@natae.notmuch> (raw)
In-Reply-To: <065528bf-b496-83d3-767d-2a78e50a9edf@gmail.com>
Mathias Kunter wrote:
> Hi all,
>
> at https://git-scm.com/docs/git-push#_description it says:
>
> > When neither the command-line nor the configuration specify what to
> > push, the default behavior is used, which corresponds to the simple
> > value for push.default: the current branch is pushed to the
> > corresponding upstream branch, but as a safety measure, the push is
> > aborted if the upstream branch does not have the same name as the local
> > one.
>
> However, on a branch which does *not* have an upstream branch
> configured, the command
>
> > git push <remote_name>
>
> doesn't use the local branch name as default,
Yes it does, but only on the src side of the refspec. Something like:
git push <remote_name> <branch_name>:
(invalid refspec)
Note the remote side is missing, so git doesn't know where to push to.
> Note that it *does* work if the remote branch name is explicitly specified:
>
> > git push <remote_name> <branch_name>
In that case git assumes you mean <branch_name>:<branch_name>.
Sounds like you want to change the default to `push.default=current`.
Cheers.
--
Felipe Contreras
next prev parent reply other threads:[~2021-05-27 19:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-27 17:06 git push doesn't use local branch name as default Mathias Kunter
2021-05-27 19:51 ` Felipe Contreras [this message]
[not found] <3b9bc214-a30a-ba49-af96-7eeaf37b7bbd@gmail.com>
2021-05-28 6:29 ` Mathias Kunter
2021-05-28 7:00 ` Elijah Newren
2021-05-28 7:44 ` Mathias Kunter
2021-05-28 8:51 ` Mathias Kunter
2021-05-28 17:52 ` Felipe Contreras
2021-05-28 17:22 ` Felipe Contreras
2021-05-28 17:44 ` Elijah Newren
2021-05-28 18:58 ` Felipe Contreras
2021-05-28 17:10 ` Felipe Contreras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=60aff85261fcf_26530208a@natae.notmuch \
--to=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=mathiaskunter@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).