All of lore.kernel.org
 help / color / mirror / Atom feed
* git branch
@ 2011-05-23 11:36 Gergely Buday
  2011-05-23 11:46 ` Marcus Karlsson
  0 siblings, 1 reply; 6+ messages in thread
From: Gergely Buday @ 2011-05-23 11:36 UTC (permalink / raw)
  To: git

Hi there,

I created

git branch install_2.0

for my install script. Then pushed to

git push origin install_2.0

so that github stores by branch

after another commit I tried to push again but git told me that I'm
not on that branch. Why git loses the state that I'm on a branch? What
should I do to have my expected behaviour?

- Gergely

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

* Re: git branch
  2011-05-23 11:36 git branch Gergely Buday
@ 2011-05-23 11:46 ` Marcus Karlsson
  2011-05-23 12:17   ` Gergely Buday
  0 siblings, 1 reply; 6+ messages in thread
From: Marcus Karlsson @ 2011-05-23 11:46 UTC (permalink / raw)
  To: Gergely Buday; +Cc: git

On Mon, May 23, 2011 at 01:36:09PM +0200, Gergely Buday wrote:
> Hi there,
> 
> I created
> 
> git branch install_2.0
> 
> for my install script. Then pushed to
> 
> git push origin install_2.0
> 
> so that github stores by branch
> 
> after another commit I tried to push again but git told me that I'm
> not on that branch. Why git loses the state that I'm on a branch? What
> should I do to have my expected behaviour?
> 
> - Gergely

I'm not sure if I'm following you correctly, but with Git you need to
check out your branch after creating it. Run git checkout install_2.0
after you have created it.

	Marcus

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

* Re: git branch
  2011-05-23 11:46 ` Marcus Karlsson
@ 2011-05-23 12:17   ` Gergely Buday
  2011-05-23 12:36     ` Tim Mazid
  0 siblings, 1 reply; 6+ messages in thread
From: Gergely Buday @ 2011-05-23 12:17 UTC (permalink / raw)
  To: Marcus Karlsson; +Cc: git

> I'm not sure if I'm following you correctly, but with Git you need to
> check out your branch after creating it. Run git checkout install_2.0
> after you have created it.

Yes, that sounds reasonable. I did not know it was necessary to "switch to it".

- Gergely

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

* RE: git branch
  2011-05-23 12:17   ` Gergely Buday
@ 2011-05-23 12:36     ` Tim Mazid
  0 siblings, 0 replies; 6+ messages in thread
From: Tim Mazid @ 2011-05-23 12:36 UTC (permalink / raw)
  To: gbuday, mk; +Cc: Git Mailing List


> From: gbuday@gmail.com
>
> > I'm not sure if I'm following you correctly, but with Git you need to
> > check out your branch after creating it. Run git checkout install_2.0
> > after you have created it.
>
> Yes, that sounds reasonable. I did not know it was necessary to "switch to it".
>
> - Gergely


Hi Gergely,

The way that git branches work is that they "point" at commits.
When you do a "git commit", git updates the branch to point at
the new commit you just created. In this way, you can have a
multitude of branches and be working on only one at a time.

N.B. If you want to create a branch and "switch" (checkout) to
it at once, you can pass the "-b" option to checkout, thus:
"git checkout -b new-branch-name"; this will create a new branch
named "new-branch-name" and immediately switch to it.


Tim.

() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
 		 	   		  

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

* Re: Git branch
  2010-07-13 22:50 Git branch jhapk
@ 2010-07-13 23:04 ` Jonathan Nieder
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Nieder @ 2010-07-13 23:04 UTC (permalink / raw)
  To: jhapk; +Cc: git

Hi,

jhapk wrote:

> I manually enter the following lines in
> the .git/config files of A1 and A2
> [branch "branchA"]
>     remote = origin
>     merge = refs/heads/branchA
> 
> Then I create a branch in the bare repository B called branchA. Once this is
> done, all the push and pull works smoothly between the two repositories. 
> 
> Just wondering, is there a better way to do this? :)

Maybe something like the following would work.

>From A1:

  git checkout -b branchA
  ... hack hack hack ...
  git push --set-upstream origin branchA
  ssh A2

>From A2:

  git checkout -t origin/branchA

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

* Git branch
@ 2010-07-13 22:50 jhapk
  2010-07-13 23:04 ` Jonathan Nieder
  0 siblings, 1 reply; 6+ messages in thread
From: jhapk @ 2010-07-13 22:50 UTC (permalink / raw)
  To: git


Hi,

I have a central bare repository B and two non-bare repositories A1 and A2.
Both A1 and A2 have B as the origin. The way I do it is that every time I
create a branch in A1, say branchA, I manually enter the following lines in
the .git/config files of A1 and A2
[branch "branchA"]
    remote = origin
    merge = refs/heads/branchA

Then I create a branch in the bare repository B called branchA. Once this is
done, all the push and pull works smoothly between the two repositories. 

Just wondering, is there a better way to do this? :)
-- 
View this message in context: http://git.661346.n2.nabble.com/Git-branch-tp5290193p5290193.html
Sent from the git mailing list archive at Nabble.com.

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

end of thread, other threads:[~2011-05-23 12:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-23 11:36 git branch Gergely Buday
2011-05-23 11:46 ` Marcus Karlsson
2011-05-23 12:17   ` Gergely Buday
2011-05-23 12:36     ` Tim Mazid
  -- strict thread matches above, loose matches on Subject: below --
2010-07-13 22:50 Git branch jhapk
2010-07-13 23:04 ` Jonathan Nieder

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.