* Switching between branches
@ 2005-04-21 1:42 Pavel Roskin
2005-04-21 7:31 ` Petr Baudis
0 siblings, 1 reply; 4+ messages in thread
From: Pavel Roskin @ 2005-04-21 1:42 UTC (permalink / raw)
To: git
Hello!
Perhaps it's a naive question, but how do I switch between branches? I
mean an equivalent of "svn switch" or "cvs update -r branch" that would
reuse the existing working directory.
I tried to switch a git-pasky working directory to the linus branch.
Here's what I tried:
git track linus
git cancel
git pull
git cancel
git merge linus
git cancel
After all that I found that README is still from the pasky branch.
Then I tried "git merge -b pasky linus" - this actually changed the
files to the linus branch, but it didn't remove files specific to
git-pasky. Also, I'm surprised that I had to specify "-b pasky", as if
the currently checked out branch is unknown.
I'm using git-pasky 0.6.2.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Switching between branches
2005-04-21 1:42 Switching between branches Pavel Roskin
@ 2005-04-21 7:31 ` Petr Baudis
2005-04-21 14:12 ` Matthias Urlichs
0 siblings, 1 reply; 4+ messages in thread
From: Petr Baudis @ 2005-04-21 7:31 UTC (permalink / raw)
To: Pavel Roskin; +Cc: git
Dear diary, on Thu, Apr 21, 2005 at 03:42:39AM CEST, I got a letter
where Pavel Roskin <proski@gnu.org> told me that...
> Hello!
Hello,
> Perhaps it's a naive question, but how do I switch between branches? I
> mean an equivalent of "svn switch" or "cvs update -r branch" that would
> reuse the existing working directory.
you can't. There was 'git update' (and intermediate never-committed 'git
switch'), but I decided not to support it for now, since I don't have
any compelling usage case for it. Do
git fork my-linus ~/my-linus linus
and you will get a local clone of Linus' branch in ~/my-linus, tracking
and everything.
> Then I tried "git merge -b pasky linus" - this actually changed the
> files to the linus branch, but it didn't remove files specific to
> git-pasky. Also, I'm surprised that I had to specify "-b pasky", as if
> the currently checked out branch is unknown.
Since git merge's purpose is to _merge_, not _switch_, so it picks the
common ancestor by default; another disadvantage is that this happens on
top of your local tree, but your history will record it as a merge which
shares both linus and my history, which isn't quite right. What is
peculiar, though, is that it didn't remove the files specific to
git-pasky.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Switching between branches
2005-04-21 7:31 ` Petr Baudis
@ 2005-04-21 14:12 ` Matthias Urlichs
2005-04-21 16:39 ` Petr Baudis
0 siblings, 1 reply; 4+ messages in thread
From: Matthias Urlichs @ 2005-04-21 14:12 UTC (permalink / raw)
To: git
Hi, Petr Baudis wrote:
> Hello,
>
>> Perhaps it's a naive question, but how do I switch between branches? I
>> mean an equivalent of "svn switch" or "cvs update -r branch" that would
>> reuse the existing working directory.
>
> you can't. There was 'git update' (and intermediate never-committed 'git
> switch'), but I decided not to support it for now, since I don't have any
> compelling usage case for it.
I do -- I have a project which builds several slightly-customized versions,
and I'd like to keep the generated objects around if possible.
So I just build one version, then "git cancel FOO" to the next version,
and let the make rules take care of rebuilding what needs to be rebuilt.
("cancel" already does most of the job anyway, i.e. cleanup stuff which
the build process might have changed that it shouldn't have.)
Cf. the last of the patches I've just mailed to the list.
--
Matthias Urlichs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Switching between branches
2005-04-21 14:12 ` Matthias Urlichs
@ 2005-04-21 16:39 ` Petr Baudis
0 siblings, 0 replies; 4+ messages in thread
From: Petr Baudis @ 2005-04-21 16:39 UTC (permalink / raw)
To: Matthias Urlichs; +Cc: git
Dear diary, on Thu, Apr 21, 2005 at 04:12:49PM CEST, I got a letter
where Matthias Urlichs <smurf@smurf.noris.de> told me that...
> Hi, Petr Baudis wrote:
>
> > Hello,
> >
> >> Perhaps it's a naive question, but how do I switch between branches? I
> >> mean an equivalent of "svn switch" or "cvs update -r branch" that would
> >> reuse the existing working directory.
> >
> > you can't. There was 'git update' (and intermediate never-committed 'git
> > switch'), but I decided not to support it for now, since I don't have any
> > compelling usage case for it.
>
> I do -- I have a project which builds several slightly-customized versions,
> and I'd like to keep the generated objects around if possible.
>
> So I just build one version, then "git cancel FOO" to the next version,
> and let the make rules take care of rebuilding what needs to be rebuilt.
I suppose we could do with git switch then.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-04-21 16:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-21 1:42 Switching between branches Pavel Roskin
2005-04-21 7:31 ` Petr Baudis
2005-04-21 14:12 ` Matthias Urlichs
2005-04-21 16:39 ` Petr Baudis
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).