git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Report a bug, about track remote repository.
@ 2012-10-20 18:49 Cheeray Huang
  2012-10-20 23:46 ` Philip Oakley
  0 siblings, 1 reply; 3+ messages in thread
From: Cheeray Huang @ 2012-10-20 18:49 UTC (permalink / raw)
  To: git

Hi,

I think I found a bug, when I used local branches to track remote 
branch. But I'm not very sure, can anyone double check this?  I'd like 
to finger this out. I think you can reproduce this bug as below steps:

precondition:

Suppose that you have a remote branch in repository, named origin/work. 
And then you want to track it with a local branch.

Steps:

1. So you can do this:

git checkout -t origin/work

now, you have a local branch also named "work" to track "origin/work".
It works nicely, you can use "push/pull" command without any detail 
parameters to sync anything with the remote branch.

2. Create another branch, ex. named "work2", to track "origin/work" 
again, though maybe there are not so many people that will do like this.

You will find that local branch "work2" can't "push" to "origin/work".
ex. After you committed something in work2, you typed "git status", git 
would tell you:

Your branch is ahead of 'origin/work' by x commit.

And then you used "git push", git can't display the information about 
changing hash value in remote branch, just printed "everything is up to 
date".

Actually, you can use some exact parameters to solve this,  such as:

git push origin work2:work

But, I still think it is a bug.

BTW, I found this bug when I used github. I don't know whether it is  
related to github.


-- 
B&R,
Cheeray

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

* Re: Report a bug, about track remote repository.
  2012-10-20 18:49 Report a bug, about track remote repository Cheeray Huang
@ 2012-10-20 23:46 ` Philip Oakley
  2012-10-21  2:44   ` Cheeray Huang
  0 siblings, 1 reply; 3+ messages in thread
From: Philip Oakley @ 2012-10-20 23:46 UTC (permalink / raw)
  To: Cheeray Huang, git

From: "Cheeray Huang" <cheeray.huang@gmail.com>
> Hi,
>
> I think I found a bug, when I used local branches to track remote 
> branch. But I'm not very sure, can anyone double check this?  I'd like 
> to finger this out. I think you can reproduce this bug as below steps:
>
> precondition:
>
> Suppose that you have a remote branch in repository, named 
> origin/work. And then you want to track it with a local branch.
>
> Steps:
>
> 1. So you can do this:
>
> git checkout -t origin/work
>
> now, you have a local branch also named "work" to track "origin/work".
> It works nicely, you can use "push/pull" command without any detail 
> parameters to sync anything with the remote branch.
>
> 2. Create another branch, ex. named "work2", to track "origin/work" 
> again, though maybe there are not so many people that will do like 
> this.

At this point you have created the 'conflict' - You can't have two 
different branches that both track the same identical remote branch and 
expect that they can be both different and identical at the same time.

>
> You will find that local branch "work2" can't "push" to "origin/work".
> ex. After you committed something in work2, you typed "git status", 
> git would tell you:
>
> Your branch is ahead of 'origin/work' by x commit.
>
> And then you used "git push", git can't display the information about 
> changing hash value in remote branch, just printed "everything is up 
> to date".

Only one push (from two branches trying) can suceed. You either force 
the remote to match the current branch, and loose any information that 
it had about the other branch, or the remote stays with one branch. 
Simply don't do it [that way]. If the local branches are different, then 
you need distinct remote branches.

>
> Actually, you can use some exact parameters to solve this,  such as:
>
> git push origin work2:work
>
> But, I still think it is a bug.
>
> BTW, I found this bug when I used github. I don't know whether it is 
> related to github.
>
>
> -- 
> B&R,
> Cheeray

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

* Re: Report a bug, about track remote repository.
  2012-10-20 23:46 ` Philip Oakley
@ 2012-10-21  2:44   ` Cheeray Huang
  0 siblings, 0 replies; 3+ messages in thread
From: Cheeray Huang @ 2012-10-21  2:44 UTC (permalink / raw)
  To: Philip Oakley; +Cc: git

On 2012年10月21日 07:46, Philip Oakley wrote:
>
> At this point you have created the 'conflict' - You can't have two 
> different branches that both track the same identical remote branch 
> and expect that they can be both different and identical at the same 
> time.

> Only one push (from two branches trying) can suceed. You either force 
> the remote to match the current branch, and loose any information that 
> it had about the other branch, or the remote stays with one branch. 
> Simply don't do it [that way]. If the local branches are different, 
> then you need distinct remote branches.

Yes, if it will lead a conflict, I think git should give a warning for 
it and prevent these operations rather than give a comment to inform you 
to push something.



-- 
Best Regards!

Qiyu Huang( Cheeray )

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

end of thread, other threads:[~2012-10-21  2:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-20 18:49 Report a bug, about track remote repository Cheeray Huang
2012-10-20 23:46 ` Philip Oakley
2012-10-21  2:44   ` Cheeray Huang

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