git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Santi Béjar" <santi@agolina.net>
To: "Bill Lear" <rael@zopyra.com>
Cc: "Sam Vilain" <sam@vilain.net>, git@vger.kernel.org
Subject: Re: Using the --track option when creating a branch
Date: Thu, 30 Oct 2008 13:41:26 +0100	[thread overview]
Message-ID: <adf1fd3d0810300541l7fb8b64nf9587fec4e481c58@mail.gmail.com> (raw)
In-Reply-To: <18697.41702.241183.408377@lisa.zopyra.com>

On Thu, Oct 30, 2008 at 1:04 PM, Bill Lear <rael@zopyra.com> wrote:
> On Wednesday, October 29, 2008 at 22:12:18 (-0700) Sam Vilain writes:
>>On Wed, 2008-10-29 at 09:23 -0600, Bill Lear wrote:
>>> We use git in a way that makes it desirable for us to only push/pull
>>> to the same remote branch.  So, if I'm in branch X, I want 'git push'
>>> to push to origin/X, and 'git pull' to fetch into origin/X and then
>>> merge into X from origin/X.
>>>
>>> In other words, we want git push/pull to behave in branches other than
>>> master the same way it does when in master.
>>>
>>> I have discovered the '--track' option when creating a local branch,
>>> and this appears to me to be the thing that gives us the desired
>>> behavior.
>>
>>As things currently stand this is not achievable behaviour.  The
>>behaviour of 'git push' is to push all matching refs.  If you are lucky
>>this is what you intended, but it also pushes any changes to *other*
>>branches that you have made.
>>
>>I have tabled a change proposal to make it work as you suggest in a
>>separate thread.
>
> Ok, now I'm confused.  The ONLY thing I want to prevent is the
> "crossing of streams" issue.  If I am on branch X and issue 'git
> push', I want X, and ONLY X, to be pushed to the remote repository's X
> branch --- I don't care if other branches are pushed to their
> respective remote branches, as long as they don't get merged to X.

No branches will get merged in a push.

>
> So, are you saying that Santi was incorrect, and that in fact
> the push will result in a merge of the branches?

Sorry, I was (partly) incorrect because I was only talking about pull.
For push you can add a "push = HEAD" config to the remote and then the
"git push" will only push the current branch (with the corresponding
matching remote branch).

$ git config remote.origin.push HEAD

Strictly speaking when you push (with the default config or with the
above trick) you push matching branches (it doesn't matter what is the
branch.<remote>.merge). Currently there is no way to say "push to the
corresponding tracking branch"

Still I think this will work as you want (as long as your local and
remote branch have the same name):

$ git clone $url
$ cd path
$ git config remote.origin.push HEAD
$ git checkout -b branch origin/branch
$ work, commit,...
$ git push

HTH,
Santi

      parent reply	other threads:[~2008-10-30 12:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-29 15:23 Using the --track option when creating a branch Bill Lear
2008-10-29 16:25 ` Santi Béjar
2008-10-29 20:33   ` Bill Lear
2008-10-30  5:12 ` Sam Vilain
2008-10-30 12:04   ` Bill Lear
2008-10-30 12:12     ` Bill Lear
2008-10-30 12:25       ` Andreas Ericsson
2008-10-30 13:52         ` Samuel Tardieu
2008-10-30 14:06           ` Andreas Ericsson
2008-10-30 14:23             ` Samuel Tardieu
2008-10-30 14:41               ` Pierre Habouzit
2008-10-30 14:56                 ` Samuel Tardieu
2008-10-30 18:00                   ` Sam Vilain
2008-10-30 14:54               ` Andreas Ericsson
2008-10-30 15:04                 ` Samuel Tardieu
2008-10-30 15:25                   ` Andreas Ericsson
2008-10-30 15:42                     ` Bill Lear
2008-10-30 19:13                       ` Marc Branchaud
2008-10-30 17:57                 ` Sam Vilain
2008-10-30 23:24               ` Jakub Narebski
2008-11-02  4:23           ` Jeff King
2008-10-30 16:44         ` Sam Vilain
2008-10-30 12:41     ` Santi Béjar [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adf1fd3d0810300541l7fb8b64nf9587fec4e481c58@mail.gmail.com \
    --to=santi@agolina.net \
    --cc=git@vger.kernel.org \
    --cc=rael@zopyra.com \
    --cc=sam@vilain.net \
    /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.
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 NNTP newsgroup(s).