[racket-dev] Git
On Thu, Jan 6, 2011 at 8:45 AM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
> On Thu, Jan 6, 2011 at 7:41 AM, Carl Eastlund <cce at ccs.neu.edu> wrote:
>>
>> You can always just leave robby/plt around, but only use it for that
>> purpose. Even if you've left it in some odd state, at any point in
>> time you can "git push --force" and it will just shove whatever you
>> have to robby/plt and erase whatever is there. It's hard to screw up
>> too badly, too -- anything you "erase" is still available for at least
>> 30 days, and you can't "push --force" to the public PLT repository
>> anyway, so it'll complain if you try.
>
> So, from my laptop, I do a push --force to robby/plt and that'll
> clobber what is there and make it match my tree? And then if I want to
> pull that to some other machine, is there an equivalent 'clobber what
> is here and just give me what is over there' variant of pull? (I
> recall when Matthew was using push --force to gr2 when it was on a
> separate branch I sometimes had to just throw away my gr2 tree and try
> again.)
First do a "git fetch <remote-name>" for that remote, or just "git
remote update" which fetches from all your remotes. Then "git reset
--hard <remote-name>/master" will clobber whatever you have and
replace it with the remote's master branch.
>> I have not had the problem you have had -- that is, my tree gets out
>> of sync but I have no trouble rebasing -- but you work on more stuff,
>> and more central stuff, than I usually do, so probably I've just been
>> lucky in that regard.
>
> I think I didn't run into that kind of trouble, if I understand
> correctly, I just did work with a tree that was as up to date as I was
> hoping it would be.
In case you find it to be an improved workflow, here's what I do: I
maintain cce/plt as a clone of plt. I work on it, on whatever branch.
Whenever I feel it has gotten too far behind -- which can be daily,
weekly, or whenever -- I run "git remote update" followed by "git
rebase plt/master". Nearly all of the time, this runs without
complaint and puts me in a state where I have exactly the plt/master
history, plus my own edits following all of that. So I can
continually develop, and push to plt only when I'm all done, but I
maintain a linear history (no forks-and-merges). It also minimizes
the amount of "clobbering" I need to do.
But the nice thing about git is there are so many ways to get things
done, you can use whatever workflow you prefer.
--Carl