Live data from Hacker News

The second-order-diff Git trick

blog.moertel.com

41–44 of 44 posts

Re: The second-order-diff Git trick

#41

I find this alias really useful for accomplishing similar goals: alias gqc="git commit -m 'quick commit'" The command is usually preceded by "git add ." (or alias "ga."). Making a commit ends up being more reliable for me than stash. Also, the commit stays with the branch, making it easy to switch to master branch, make or check an important change, then go back to what I was working on in the develop branch. Additio…

[deleted]

Re: The second-order-diff Git trick

#42
post #35

It looks like what you're really looking for is a local branch that you never push to the remote, and 'git diff master...' with 'git rebase'. Create a local branch, apply the sledgehammer, and start reviewing changes. Use 'git diff master...' to review changes. (This is short for 'git diff master...HEAD' which in turn stands for 'compare current branch's HEAD with the commit on master off of which you've branched.) '…

In this case, however, I don't want to use something like `git add -p` to pick the sledgehammer's good effects from the bad. That there are bad effects means the original sledgehammer was wrong. I want to fix the sledgehammer.

Yes, I could accept the good effects and then create a new sledgehammer to attempt to fix the bad effects (without affecting any good effects or any original code that just happens to look like a bad effect), but it's easier and more reliable to just roll back all of the effects, fix the original sledgehammer (tweak the regex), and reapply it to the original clean slate.

Re: The second-order-diff Git trick

#43
post #31
post #20

Earlier quoted context omitted.

as i said in my other comment. that will only work for idempotent things: if you like to change, say, ' to ", the workflow in the article works, but git add -p won't.

I don't follow you. Any time I'm inspecting the diff to see if I made the change I want, staging the changes i want progressively and then discarding the rest has worked well.

the important part missing in my example is the 'vice versa'. the canonical example is:

> sledge() { tr ab ba then, you might undo a change you already -p added.

more convincing might be (using gnu sed):

> sledge() { sed -i s/identifier/long_identifier/ $1 }

a second iteration will eventually generate long_long_identifier.

Re: The second-order-diff Git trick

#44
post #7

This is very useful, as the article describes in detail. I've found it useful to be able do diffs of diffs in my work, hence I'm planning to add the ability to do that to my toolset. Combined with live editing, I think it's going to be quite neat.

Delivered: https://dl.dropbox.com/u/8554242/dmitri/projects/Conception/...
Post reply on HN