git branch help?
Peter Hutterer
peter.hutterer at who-t.net
Tue Aug 3 07:23:45 UTC 2010
On Tue, Aug 03, 2010 at 09:12:48AM +0200, Kevin Kofler wrote:
> Oh, and I forgot:
>
> Peter Hutterer wrote:
> > it's likely that one you get used to git you'll be using branches heavily.
> > And once you start using several branches interchangably, directories
> > don't cut it anymore compared to git.
> >
> > one example: updating to a new version of the wacom driver was a matter of
> > fedpkg clone xorg-x11-drv-wacom
> > <update master branch>
> > fedpkg commit && fedpkg push && fedpkg build
> >
> > fedpkg switch-branch f14
> > git cherry-pick master
> > fedpkg commit && fedpkg push && fedpkg build
> >
> > fedpkg switch-branch f13
> > git cherry-pick master
> > fedpkg commit && fedpkg push && fedpkg build
>
> I don't see why I'd want to magically switch the branch of my directory to
> do this.
>
> This makes much more sense (assuming a fedpkg clone -B that actually works,
> I don't know whether they already fixed that, and I guess you need to do
> those extra git pull operations if you work that way due to git's ugly
> design):
>
> fedpkg clone -B xorg-x11-drv-wacom
> cd xorg-x11-drv-wacom/master
> <update master branch>
> fedpkg commit && fedpkg push && fedpkg build
>
> cd ../f14
> git pull
> git cherry-pick master
> fedpkg commit && fedpkg push && fedpkg build
>
> cd ../f13
> git pull
> git cherry-pick master
> fedpkg commit && fedpkg push && fedpkg build
>
> That way the contents of your directories always contain the same branch, so
> you don't end up accidentally committing to the wrong one. But I guess git
> will be storing a lot of redundant stuff and forcing extra pulls if you work
> that way. :-(
correct, git will share objects between branches, so by storing in different
directories you'll loose that advantage.
I've got a shell prompt that shows me the branch name whenever I enter a git
directory so I don't have to worry about committing to the wrong branch.
other than that - your approach is as valid as the one I described above.
which one you do depends on personal preference. And you can still to the
spec-file copying as well. the end result is the same in all three cases.
Cheers,
Peter
More information about the devel
mailing list