{"thread":{"id":"186","subject":"Switching between branches","startedAt":"2005-04-21T01:42:39Z","lastAt":"2005-04-21T16:39:58Z","messageCount":4,"participants":["Pavel Roskin","Petr Baudis","Matthias Urlichs"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"1077","messageId":"1114047759.20044.22.camel@dv","threadId":"186","inReplyTo":null,"subject":"Switching between branches","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-04-21T01:42:39Z","receivedAt":"2005-04-21T01:42:39Z","isPatch":false,"sender":{"key":"proski@gnu.org","avatar":null},"body":"Hello!\n\nPerhaps it's a naive question, but how do I switch between branches?  I\nmean an equivalent of \"svn switch\" or \"cvs update -r branch\" that would\nreuse the existing working directory.\n\nI tried to switch a git-pasky working directory to the linus branch.\n\nHere's what I tried:\n\ngit track linus\ngit cancel\ngit pull\ngit cancel\ngit merge linus\ngit cancel\n\nAfter all that I found that README is still from the pasky branch.\n\nThen I tried \"git merge -b pasky linus\" - this actually changed the\nfiles to the linus branch, but it didn't remove files specific to\ngit-pasky.  Also, I'm surprised that I had to specify \"-b pasky\", as if\nthe currently checked out branch is unknown.\n\nI'm using git-pasky 0.6.2.\n\n-- \nRegards,\nPavel Roskin\n\n"},{"id":"1103","messageId":"20050421073123.GD31910@pasky.ji.cz","threadId":"186","inReplyTo":"1114047759.20044.22.camel@dv","subject":"Re: Switching between branches","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-04-21T07:31:23Z","receivedAt":"2005-04-21T07:31:23Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Thu, Apr 21, 2005 at 03:42:39AM CEST, I got a letter\nwhere Pavel Roskin <proski@gnu.org> told me that...\n> Hello!\n\nHello,\n\n> Perhaps it's a naive question, but how do I switch between branches?  I\n> mean an equivalent of \"svn switch\" or \"cvs update -r branch\" that would\n> reuse the existing working directory.\n\nyou can't. There was 'git update' (and intermediate never-committed 'git\nswitch'), but I decided not to support it for now, since I don't have\nany compelling usage case for it. Do\n\n\tgit fork my-linus ~/my-linus linus\n\nand you will get a local clone of Linus' branch in ~/my-linus, tracking\nand everything.\n\n> Then I tried \"git merge -b pasky linus\" - this actually changed the\n> files to the linus branch, but it didn't remove files specific to\n> git-pasky.  Also, I'm surprised that I had to specify \"-b pasky\", as if\n> the currently checked out branch is unknown.\n\nSince git merge's purpose is to _merge_, not _switch_, so it picks the\ncommon ancestor by default; another disadvantage is that this happens on\ntop of your local tree, but your history will record it as a merge which\nshares both linus and my history, which isn't quite right. What is\npeculiar, though, is that it didn't remove the files specific to\ngit-pasky.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"1130","messageId":"pan.2005.04.21.14.12.46.905838@smurf.noris.de","threadId":"186","inReplyTo":"20050421073123.GD31910@pasky.ji.cz","subject":"Re: Switching between branches","fromName":"Matthias Urlichs","fromEmail":"smurf@smurf.noris.de","sentAt":"2005-04-21T14:12:49Z","receivedAt":"2005-04-21T14:12:49Z","isPatch":false,"sender":{"key":"matthias@urlichs.de","avatar":"https://gravatar.com/avatar/2708905af227313eba6f2b2ae0f7d0259b5ac5d71baef58fe5a13c699ce0bbf0?d=mp&s=160"},"body":"Hi, Petr Baudis wrote:\n\n> Hello,\n> \n>> Perhaps it's a naive question, but how do I switch between branches?  I\n>> mean an equivalent of \"svn switch\" or \"cvs update -r branch\" that would\n>> reuse the existing working directory.\n> \n> you can't. There was 'git update' (and intermediate never-committed 'git\n> switch'), but I decided not to support it for now, since I don't have any\n> compelling usage case for it.\n\nI do -- I have a project which builds several slightly-customized versions,\nand I'd like to keep the generated objects around if possible.\n\nSo I just build one version, then \"git cancel FOO\" to the next version,\nand let the make rules take care of rebuilding what needs to be rebuilt.\n\n(\"cancel\" already does most of the job anyway, i.e. cleanup stuff which\nthe build process might have changed that it shouldn't have.)\n\nCf. the last of the patches I've just mailed to the list.\n-- \nMatthias Urlichs\n\n"},{"id":"1144","messageId":"20050421163958.GI30991@pasky.ji.cz","threadId":"186","inReplyTo":"pan.2005.04.21.14.12.46.905838@smurf.noris.de","subject":"Re: Switching between branches","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-04-21T16:39:58Z","receivedAt":"2005-04-21T16:39:58Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Thu, Apr 21, 2005 at 04:12:49PM CEST, I got a letter\nwhere Matthias Urlichs <smurf@smurf.noris.de> told me that...\n> Hi, Petr Baudis wrote:\n> \n> > Hello,\n> > \n> >> Perhaps it's a naive question, but how do I switch between branches?  I\n> >> mean an equivalent of \"svn switch\" or \"cvs update -r branch\" that would\n> >> reuse the existing working directory.\n> > \n> > you can't. There was 'git update' (and intermediate never-committed 'git\n> > switch'), but I decided not to support it for now, since I don't have any\n> > compelling usage case for it.\n> \n> I do -- I have a project which builds several slightly-customized versions,\n> and I'd like to keep the generated objects around if possible.\n> \n> So I just build one version, then \"git cancel FOO\" to the next version,\n> and let the make rules take care of rebuilding what needs to be rebuilt.\n\nI suppose we could do with git switch then.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"}]}