* Git repository and branches ?
@ 2008-02-21 2:00 Xavier Maillard
2008-02-21 1:48 ` Miles Bader
0 siblings, 1 reply; 14+ messages in thread
From: Xavier Maillard @ 2008-02-21 2:00 UTC (permalink / raw)
To: emacs-devel
Hi,
How can I get a specific branch of the current CVS using the git
repository ? Cloning the git repository has only fetched the
master branch.
Regards,
Xavier
--
http://www.gnu.org
http://www.april.org
http://www.lolica.org
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Git repository and branches ?
2008-02-21 2:00 Git repository and branches ? Xavier Maillard
@ 2008-02-21 1:48 ` Miles Bader
2008-02-21 20:37 ` Michael Olson
2008-02-22 2:00 ` Xavier Maillard
0 siblings, 2 replies; 14+ messages in thread
From: Miles Bader @ 2008-02-21 1:48 UTC (permalink / raw)
To: Xavier Maillard; +Cc: emacs-devel
Xavier Maillard <xma@gnu.org> writes:
> How can I get a specific branch of the current CVS using the git
> repository ? Cloning the git repository has only fetched the
> master branch.
Cloning with git fetches _all_ branches that exist in the cloned git
repo. They are under the "origin/" namespace.
You can see them with:
git branch -a
To switch your working directory to one of those branches, you can use
the git-checkout command. It's possibly to simply checkout one of the
origin branches (e.g., "git checkout origin/lexbind"), but generally you
don't want to do unless you're not going to do any modifications (the
reason is that "origin/" branches are supposed to represent the pristine
contents of the repo you cloned from, to make future interaction
easier). So the more usual method is to create a local branch which
tracks the given origin branch, e.g.:
git checkout -b lexbind origin/lexbind
[After that, you can switch to your local lexbind branch by just
using "git checkout lexbind"; to switch back to the trunk, use
"git checkout master".]
-Miles
--
Quack, n. A murderer without a license.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Git repository and branches ?
2008-02-21 1:48 ` Miles Bader
@ 2008-02-21 20:37 ` Michael Olson
2008-02-21 22:29 ` Miles Bader
2008-02-22 2:00 ` Xavier Maillard
1 sibling, 1 reply; 14+ messages in thread
From: Michael Olson @ 2008-02-21 20:37 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]
Miles Bader <miles@gnu.org> writes:
> To switch your working directory to one of those branches, you can use
> the git-checkout command. It's possibly to simply checkout one of the
> origin branches (e.g., "git checkout origin/lexbind"), but generally
> you don't want to do unless you're not going to do any modifications
> (the reason is that "origin/" branches are supposed to represent the
> pristine contents of the repo you cloned from, to make future
> interaction easier). So the more usual method is to create a local
> branch which tracks the given origin branch, e.g.:
>
> git checkout -b lexbind origin/lexbind
If you want to track changes made to that branch in the remote repo, you
can alternatively do:
git branch --track lexbind origin/lexbind
--
| Michael Olson | FSF Associate Member #652 |
| http://mwolson.org/ | Hobbies: Lisp, HCoop |
| Projects: Emacs, Muse, ERC, EMMS, ErBot, DVC, Planner |
`-------------------------------------------------------'
[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Git repository and branches ?
2008-02-21 20:37 ` Michael Olson
@ 2008-02-21 22:29 ` Miles Bader
0 siblings, 0 replies; 14+ messages in thread
From: Miles Bader @ 2008-02-21 22:29 UTC (permalink / raw)
To: Michael Olson; +Cc: emacs-devel
Michael Olson <mwolson@gnu.org> writes:
>> git checkout -b lexbind origin/lexbind
>
> If you want to track changes made to that branch in the remote repo, you
> can alternatively do:
>
> git branch --track lexbind origin/lexbind
Hmm, tracking is the default with my settings; not sure what the default
settings are these days (I have a vague memory that tracking may be the
default too).
-Miles
--
"Most attacks seem to take place at night, during a rainstorm, uphill,
where four map sheets join." -- Anon. British Officer in WW I
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Git repository and branches ?
2008-02-21 1:48 ` Miles Bader
2008-02-21 20:37 ` Michael Olson
@ 2008-02-22 2:00 ` Xavier Maillard
2008-02-22 3:01 ` Miles Bader
1 sibling, 1 reply; 14+ messages in thread
From: Xavier Maillard @ 2008-02-22 2:00 UTC (permalink / raw)
To: Miles Bader; +Cc: emacs-devel
Xavier Maillard <xma@gnu.org> writes:
> How can I get a specific branch of the current CVS using the git
> repository ? Cloning the git repository has only fetched the
> master branch.
Cloning with git fetches _all_ branches that exist in the cloned git
repo. They are under the "origin/" namespace.
Right.
git checkout -b lexbind origin/lexbind
[After that, you can switch to your local lexbind branch by just
using "git checkout lexbind"; to switch back to the trunk, use
"git checkout master".]
Will my local git repository be able to "track" the activity of
the branch I am working. In short, will git-pull also fetch
branches ? If not, how can I tell it to automatically track and
fetch any change made on a given remote branch ?
Regards,
Xavier
--
http://www.gnu.org
http://www.april.org
http://www.lolica.org
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Git repository and branches ?
2008-02-22 2:00 ` Xavier Maillard
@ 2008-02-22 3:01 ` Miles Bader
2008-02-22 9:58 ` Andreas Schwab
2008-02-23 2:00 ` Xavier Maillard
0 siblings, 2 replies; 14+ messages in thread
From: Miles Bader @ 2008-02-22 3:01 UTC (permalink / raw)
To: Xavier Maillard; +Cc: emacs-devel
Xavier Maillard <xma@gnu.org> writes:
> git checkout -b lexbind origin/lexbind
>
> [After that, you can switch to your local lexbind branch by just
> using "git checkout lexbind"; to switch back to the trunk, use
> "git checkout master".]
>
> Will my local git repository be able to "track" the activity of
> the branch I am working. In short, will git-pull also fetch
> branches?
That command should set up a "tracking branch" by default (I just
checked, and indeed --track is now the default; it didn't use to be,
though, so be aware if you have an old version of git), which means
that "git pull" will fetch and merge the current branch.
[I'm a bit fuzzy on what exactly gets _fetched_ by default -- whether
all branches from the origin remote, or only the origin branch
corresponding to the current branch -- but I know only the current
branch will be _merged_ when you do "git pull" or "git merge". So
after using "git checkout BRANCH" to switch to a new branch, it's a
good idea to use "git pull" again to make sure it's up to date.]
-Miles
--
Marriage, n. The state or condition of a community consisting of a master, a
mistress and two slaves, making in all, two.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Git repository and branches ?
2008-02-22 3:01 ` Miles Bader
@ 2008-02-22 9:58 ` Andreas Schwab
2008-02-23 2:00 ` Xavier Maillard
2008-02-23 2:00 ` Xavier Maillard
1 sibling, 1 reply; 14+ messages in thread
From: Andreas Schwab @ 2008-02-22 9:58 UTC (permalink / raw)
To: Miles Bader; +Cc: Xavier Maillard, emacs-devel
Miles Bader <miles.bader@necel.com> writes:
> [I'm a bit fuzzy on what exactly gets _fetched_ by default -- whether
> all branches from the origin remote, or only the origin branch
> corresponding to the current branch
It's the former: git clone sets up the default refspec to fetch all
branches from the origin remote
(remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*).
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Git repository and branches ?
2008-02-22 9:58 ` Andreas Schwab
@ 2008-02-23 2:00 ` Xavier Maillard
2008-02-23 8:54 ` Andreas Schwab
0 siblings, 1 reply; 14+ messages in thread
From: Xavier Maillard @ 2008-02-23 2:00 UTC (permalink / raw)
To: Andreas Schwab; +Cc: emacs-devel, miles
Miles Bader <miles.bader@necel.com> writes:
> [I'm a bit fuzzy on what exactly gets _fetched_ by default -- whether
> all branches from the origin remote, or only the origin branch
> corresponding to the current branch
It's the former: git clone sets up the default refspec to fetch all
branches from the origin remote
(remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*).
Where did you see this information exactly ?
Xavier
--
http://www.gnu.org
http://www.april.org
http://www.lolica.org
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Git repository and branches ?
2008-02-23 2:00 ` Xavier Maillard
@ 2008-02-23 8:54 ` Andreas Schwab
2008-02-24 2:00 ` Xavier Maillard
0 siblings, 1 reply; 14+ messages in thread
From: Andreas Schwab @ 2008-02-23 8:54 UTC (permalink / raw)
To: Xavier Maillard; +Cc: emacs-devel, miles
Xavier Maillard <xma@gnu.org> writes:
> Miles Bader <miles.bader@necel.com> writes:
>
> > [I'm a bit fuzzy on what exactly gets _fetched_ by default -- whether
> > all branches from the origin remote, or only the origin branch
> > corresponding to the current branch
>
> It's the former: git clone sets up the default refspec to fetch all
> branches from the origin remote
> (remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*).
>
> Where did you see this information exactly ?
$ git config -l
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Git repository and branches ?
2008-02-22 3:01 ` Miles Bader
2008-02-22 9:58 ` Andreas Schwab
@ 2008-02-23 2:00 ` Xavier Maillard
2008-02-23 2:53 ` Miles Bader
1 sibling, 1 reply; 14+ messages in thread
From: Xavier Maillard @ 2008-02-23 2:00 UTC (permalink / raw)
To: Miles Bader; +Cc: emacs-devel
Xavier Maillard <xma@gnu.org> writes:
> git checkout -b lexbind origin/lexbind
>
> [After that, you can switch to your local lexbind branch by just
> using "git checkout lexbind"; to switch back to the trunk, use
> "git checkout master".]
>
> Will my local git repository be able to "track" the activity of
> the branch I am working. In short, will git-pull also fetch
> branches?
That command should set up a "tracking branch" by default (I just
checked, and indeed --track is now the default; it didn't use to be,
though, so be aware if you have an old version of git), which means
that "git pull" will fetch and merge the current branch.
[I'm a bit fuzzy on what exactly gets _fetched_ by default -- whether
all branches from the origin remote, or only the origin branch
corresponding to the current branch -- but I know only the current
branch will be _merged_ when you do "git pull" or "git merge". So
after using "git checkout BRANCH" to switch to a new branch, it's a
good idea to use "git pull" again to make sure it's up to date.]
Once again, thank you very much for your help. I tested it here
and it worked like a charm. The only drawback is that switching
from a branch to master and vice versa takes very long...
I can live with that though.
Xavier
--
http://www.gnu.org
http://www.april.org
http://www.lolica.org
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Git repository and branches ?
2008-02-23 2:00 ` Xavier Maillard
@ 2008-02-23 2:53 ` Miles Bader
2008-02-24 2:00 ` Xavier Maillard
2008-02-24 2:00 ` Xavier Maillard
0 siblings, 2 replies; 14+ messages in thread
From: Miles Bader @ 2008-02-23 2:53 UTC (permalink / raw)
To: Xavier Maillard; +Cc: emacs-devel
Xavier Maillard <xma@gnu.org> writes:
> I tested it here and it worked like a charm. The only drawback is that
> switching from a branch to master and vice versa takes very long...
Really? That's very surprising. For me it's about 5 seconds to switch
between some emacs branches, with a cold FS cache (once stuff is in the
filesystem cache, switching is essentially instanteous).
Are you per-chance using windows?
-miles
--
=====
(^o^;
(()))
*This is the cute octopus virus, please copy it into your sig so it can spread.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Git repository and branches ?
2008-02-23 2:53 ` Miles Bader
@ 2008-02-24 2:00 ` Xavier Maillard
2008-02-24 2:00 ` Xavier Maillard
1 sibling, 0 replies; 14+ messages in thread
From: Xavier Maillard @ 2008-02-24 2:00 UTC (permalink / raw)
To: Miles Bader; +Cc: emacs-devel
Xavier Maillard <xma@gnu.org> writes:
> I tested it here and it worked like a charm. The only drawback is that
> switching from a branch to master and vice versa takes very long...
Really? That's very surprising. For me it's about 5 seconds to switch
between some emacs branches, with a cold FS cache (once stuff is in the
filesystem cache, switching is essentially instanteous).
Maybe is has to do with the hardware then; my /home is mounted
onto a SDHC card as my current laptop does not have a valid
internal HDD.
Are you per-chance using windows?
Are you joking ? :) I am using a real GNU/linux system, more
precisely, it is a Slackware 12.0 GNU/linux system.
Xavier
--
http://www.gnu.org
http://www.april.org
http://www.lolica.org
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Git repository and branches ?
2008-02-23 2:53 ` Miles Bader
2008-02-24 2:00 ` Xavier Maillard
@ 2008-02-24 2:00 ` Xavier Maillard
1 sibling, 0 replies; 14+ messages in thread
From: Xavier Maillard @ 2008-02-24 2:00 UTC (permalink / raw)
To: Miles Bader; +Cc: emacs-devel
Xavier Maillard <xma@gnu.org> writes:
> I tested it here and it worked like a charm. The only drawback is that
> switching from a branch to master and vice versa takes very long...
Really? That's very surprising. For me it's about 5 seconds to switch
between some emacs branches, with a cold FS cache (once stuff is in the
filesystem cache, switching is essentially instanteous).
Maybe is has to do with the hardware then; my /home is mounted
onto a SDHC card as my current laptop does not have a valid
internal HDD.
Here are the results of consecutive git branch/git checkout:
xma@localhost> git branch ~/usr/src/GITed/emacs
* master
rmail-mbox
xma@localhost> time git checkout rmail-mbox ~/usr/src/GITed/emacs
Switched to branch "rmail-mbox"
git checkout rmail-mbox 5.97s user 1.04s system 6% cpu 1:41.16 total
xma@localhost> git branch ~/usr/src/GITed/emacs
master
* rmail-mbox
xma@localhost> time git checkout master ~/usr/src/GITed/emacs
Switched to branch "master"
git checkout master 5.16s user 0.88s system 8% cpu 1:07.25 total
As you can see, the results are really bad but I do not
switch between branch so often.
Are you per-chance using windows?
Are you joking ? :) I am using a real GNU/linux system, more
precisely, it is a Slackware 12.0 GNU/linux system.
Xavier
--
http://www.gnu.org
http://www.april.org
http://www.lolica.org
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2008-02-24 2:00 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-21 2:00 Git repository and branches ? Xavier Maillard
2008-02-21 1:48 ` Miles Bader
2008-02-21 20:37 ` Michael Olson
2008-02-21 22:29 ` Miles Bader
2008-02-22 2:00 ` Xavier Maillard
2008-02-22 3:01 ` Miles Bader
2008-02-22 9:58 ` Andreas Schwab
2008-02-23 2:00 ` Xavier Maillard
2008-02-23 8:54 ` Andreas Schwab
2008-02-24 2:00 ` Xavier Maillard
2008-02-23 2:00 ` Xavier Maillard
2008-02-23 2:53 ` Miles Bader
2008-02-24 2:00 ` Xavier Maillard
2008-02-24 2:00 ` Xavier Maillard
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.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).