On Feb 12, 2009, at 0:22, Robert Spier wrote:
Ah; git is great. :-) Basically this is like passing a patch
around,
but with tools that are made to work with it. (We could also have
had
three commits with two of them just having for the history books
useless tweaks).
Kind of. I used git am and then git commit --amend a few times, which
didn't feel like the cleanest way to do it. I'd much rather git am
apply the patch and set the appropriate metadata, but it not be
committed until I actually want it to (so I can tweak it.)
Yeah - it's a little odd until you get used to it.
If you didn't have git commit --amend, then the manual-ish version
would be something like:
# undo the last commit; keep the changes in the working copy
git reset --mixed HEAD^
emacs
GIT_AUTHOR_NAME="Joe Doe" GIT_AUTHOR_EMAIL="j...@example.com" git
commit some/file
Another variation which I actually use sometimes is to just commit and
commit and then use "git rebase -i" ("interactive") to merge the tweak/
typo commits together before pushing.
# revisit the last four commits
git rebase -i HEAD~4
I cherry-picked it, did a few more tweaks to the documentation and
committed to my master. Now because you have a commit I didn't pick
up, the easiest way to keep your git history clean is to do a "git
rebase abh/master" (or whatever you called my remote).
Each time we do this, I think it's a pain. (I also think you should
just accept that patch.)
Yeah, I did that now (included David Nicols random error plugin).
Anyway - the real answer is: Topic branches! :-)
In this case you could have saved the plugin to a new branch with:
git branch topic/random_error_plugin $commit_id
and then deleted the commit from your master branch:
git rebase -i HEAD~4
(editor comes up with instructions).
git remote add abh git://github.com/abh/qpsmtpd.git
git remote update
git rebase abh/master
Since I made changes to the README file that will likely conflict
with
yours, git will report a conflict. Since it was basically the same
change, you can just do
git rebase --skip
to toss your change away. You'll be left with a new history with this
new commit as HEAD~1 and the random error plugin as your last change.
About here is where I ended up making my local WC very unhappy.
Probably removing the .dotest directory wasn't the best idea(tm), but
I'm pretty sure the instructions told me to do that.
If .dotest was around I think the rebase maybe didn't finish? (Not
entirely sure - it sounds familiar, but from a mistake I haven't made
for a while).
(The way to avoid having to do the rebase to keep the history clean
is
to put ~everything on topic branches).
That seems like a bunch of extra work.
Not at all. Branches are cheap, lightweight, fast and easy. At
$work we use a shared repository, but more or less only commit one
line typo fixes directly on master; everything else gets a branch and
is then merged in to master.
I'm sending you
http://github.com/rspier/qpsmtpd/commit/b3c10c6220ae356e0609e3f07929cd5cb3f77bb3
,
to get some of this written down.
Great, thank you!
- ask
--
http://develooper.com/ - http://askask.com/