From: Junio C Hamano <junkio@cox.net>
To: Carl Worth <cworth@cworth.org>
Cc: Martin Langhoff <martin@catalyst.net.nz>,
git@vger.kernel.org, junkio@cox.net
Subject: Re: [RFC] git-clone: add --track <headname> support
Date: Thu, 12 Apr 2007 20:50:35 -0700 [thread overview]
Message-ID: <7vps69gcfo.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <87slb5tbvu.wl%cworth@cworth.org> (Carl Worth's message of "Thu, 12 Apr 2007 16:24:05 -0700")
Carl Worth <cworth@cworth.org> writes:
> I'd love to get that down to:
>
> git clone <something with <repo> and <branch>>
> cd <project>
> git pull # as needed
>
> and then adding a subsequent branch to track would be:
>
> git track <something with <repo> and <branch>>
> git checkout <branch>
> git pull # as needed
I have a different suggestion. Why not forget about 'git clone'?
After working in a clone of git.git, if you want to use the
project history from another related repository, say Shawn's
fastimport, what would you do?
Yes. You add it with "git remote add".
git remote add [options] gfi git://repo.or.cz/git/fastimport.git/
If you are _not_ working off of anybody else's work, how would
you start a repository?
Yes, you just do "git init" in an empty repository.
git init
And after that, in such a repository, certainly "git remote add"
to add the FIRST remote would work, wouldn't it?
So, how about this two-command sequence instead?
(0) Have this in $HOME/.gitconfig:
$ cat >>$HOME/.gitconfig <<\EOF
[branch]
autosetupmerge
EOF
(1) Prepare your working area and add the remote you want to
track, with initial fetch:
$ git remote add -f origin git://repo.or.cz/alt-git.git/
(2) If you want to fork off of next, you can:
$ git checkout -b next origin/next
The result of (2) reads like this:
$ cat .git/config
[remote "origin"]
url = /opt/packrat/playpen/public/in-place/git/git.junio/
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "next"]
remote = origin
merge = refs/heads/next
The [remote "origin"] section was added with (1), and [branch
"next"] was done with (2). It means "When I am on 'next', if I
did not give any parameter to 'git pull', I want a fetch from
'origin', and then get their 'next' branch merged.".
So after setting up your 'next' branch with a single command (2),
when you are finished working in your 'next' and are ready to
merge the corresponding 'next' branch of 'origin', you can just
say 'git pull'. Isn't this what you want?
And I do not think trying to mix up (1) and (2) is a great idea.
Whenever you are interested in yet another person's work, you do
(1). And whenever you want to fork off of some remote tracking
branch you have already done (1) for, you do (2). IOW, you can
do more than one (2) for a single remote repository.
prev parent reply other threads:[~2007-04-13 3:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-12 10:08 [RFC] git-clone: add --track <headname> support Martin Langhoff
2007-04-12 10:23 ` Junio C Hamano
2007-04-12 21:32 ` Martin Langhoff
2007-04-12 16:34 ` Carl Worth
2007-04-12 21:46 ` Martin Langhoff
2007-04-12 23:24 ` Carl Worth
2007-04-12 23:50 ` Martin Langhoff
2007-04-13 0:28 ` Junio C Hamano
2007-04-13 3:50 ` Junio C Hamano [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=7vps69gcfo.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=cworth@cworth.org \
--cc=git@vger.kernel.org \
--cc=martin@catalyst.net.nz \
/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).