git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git pull merges current branch even when <dst> is specified
@ 2009-06-24 16:47 Tom Lambda
  2009-06-25  8:52 ` Michael J Gruber
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Lambda @ 2009-06-24 16:47 UTC (permalink / raw)
  To: git


If I am in 'master' and 'bugfix' is a remote branch in 'repo' which I do not
have locally yet, running:

git pull repo bugfix:bugfix

creates a new local branch 'bugfix' equals to 'repo/bugfix' as expected.
However, it also merges 'bugfix' into 'master', that surprises me since I
explicitly specify that <dst> is 'bugfix'.

I know that I can get what I want by running:

git fetch repo bugfix:bugfix

But the git-pull behavior looks odd to me. I thought that <dst> was the
current branch by default and it could be overridden by specifying it in the
command line.

Thank you,
Tom

-- 
View this message in context: http://n2.nabble.com/git-pull-merges-current-branch-even-when-%3Cdst%3E-is-specified-tp3149948p3149948.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git pull merges current branch even when <dst> is specified
  2009-06-24 16:47 git pull merges current branch even when <dst> is specified Tom Lambda
@ 2009-06-25  8:52 ` Michael J Gruber
  2009-06-25  9:44   ` Johannes Schindelin
  0 siblings, 1 reply; 4+ messages in thread
From: Michael J Gruber @ 2009-06-25  8:52 UTC (permalink / raw)
  To: Tom Lambda; +Cc: git

Tom Lambda venit, vidit, dixit 24.06.2009 18:47:
> 
> If I am in 'master' and 'bugfix' is a remote branch in 'repo' which I do not
> have locally yet, running:
> 
> git pull repo bugfix:bugfix
> 
> creates a new local branch 'bugfix' equals to 'repo/bugfix' as expected.
> However, it also merges 'bugfix' into 'master', that surprises me since I
> explicitly specify that <dst> is 'bugfix'.
> 
> I know that I can get what I want by running:
> 
> git fetch repo bugfix:bugfix
> 
> But the git-pull behavior looks odd to me. I thought that <dst> was the
> current branch by default and it could be overridden by specifying it in the
> command line.

Well, the first line of git-pull's man page says:

Runs git-fetch with the given parameters, and calls git-merge to merge
the retrieved head(s) into the current branch.

So I can't help but call your surprise somewhat unjustified ;)

Michael

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git pull merges current branch even when <dst> is specified
  2009-06-25  8:52 ` Michael J Gruber
@ 2009-06-25  9:44   ` Johannes Schindelin
  2009-06-25 13:28     ` Tom Lambda
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2009-06-25  9:44 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Tom Lambda, git

Hi,

On Thu, 25 Jun 2009, Michael J Gruber wrote:

> Tom Lambda venit, vidit, dixit 24.06.2009 18:47:
> > 
> > If I am in 'master' and 'bugfix' is a remote branch in 'repo' which I do not
> > have locally yet, running:
> > 
> > git pull repo bugfix:bugfix
> > 
> > creates a new local branch 'bugfix' equals to 'repo/bugfix' as expected.
> > However, it also merges 'bugfix' into 'master', that surprises me since I
> > explicitly specify that <dst> is 'bugfix'.
> > 
> > I know that I can get what I want by running:
> > 
> > git fetch repo bugfix:bugfix
> > 
> > But the git-pull behavior looks odd to me. I thought that <dst> was the
> > current branch by default and it could be overridden by specifying it in the
> > command line.
> 
> Well, the first line of git-pull's man page says:
> 
> Runs git-fetch with the given parameters, and calls git-merge to merge
> the retrieved head(s) into the current branch.

To explain why this is so: Merging is an operation that requires a working 
directory, as merge conflicts can happen.  That is why merging is only 
possible locally, and only into the current branch.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git pull merges current branch even when <dst> is specified
  2009-06-25  9:44   ` Johannes Schindelin
@ 2009-06-25 13:28     ` Tom Lambda
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Lambda @ 2009-06-25 13:28 UTC (permalink / raw)
  To: git


Thank you for the explanation.

So specifying :<dst> in git-pull does not seem that useful now to me, since
one has to checkout the <dst> branch anyway to keep other branches
unaltered.

Thanks again,
Tom


Johannes Schindelin wrote:
> 
> 
> To explain why this is so: Merging is an operation that requires a working 
> directory, as merge conflicts can happen.  That is why merging is only 
> possible locally, and only into the current branch.
> 
> 

-- 
View this message in context: http://n2.nabble.com/git-pull-merges-current-branch-even-when-%3Cdst%3E-is-specified-tp3149948p3155010.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-25 13:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-24 16:47 git pull merges current branch even when <dst> is specified Tom Lambda
2009-06-25  8:52 ` Michael J Gruber
2009-06-25  9:44   ` Johannes Schindelin
2009-06-25 13:28     ` Tom Lambda

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).