On 16 Apr 2008, at 16:35, Wincent Colaiuta wrote:
> > El 16/4/2008, a las 16:21, Garry Hill escribió: >> >> incidentally, since git claims to track content rather than files, is >> there a clever, gittish, way to revert single line changes within a >> single commit? i just had to make prolific use of the undo key and >> there's gotta be a better way... > > You can _stage_ individual hunks using: > > git add --interactive I've been trying to understand this stuff, the use of the index and this idea of staging, but at the moment it's a bit much. > A different notion is that of "resetting", which involves going back > to an earlier point in the history so that you can change the > commit(s). See the "git-reset" man page for details on the different > types of reset that you can do. For more complicated history > manipulation their's "rebasing" (see the man page for "git-rebase", > especially "git rebase --interactive"). I've been using 'git reset --soft HEAD~1' (say) which is cool. One weird thing is that once you've done that 'git status' says there are uncommitted changes, but 'git diff' shows nothing. > So, in a non-public repo, which I assume yours is, you can just redo > the commit: > > git reset HEAD^ > git add --interactive # or whatever Ah ha. I'll try that later. Many thanks for your help. g > > > In a _public_ repo you'd have to do a real revert, and the easiest way > to do that it probably produce a reverse patch corresponding to the > commit that you want to partially counteract, edit the patch to remove > the hunks which shouldn't be reverted, and then apply it. > > Something like this would work; here I'm making a reverse patch for > the changes introduced from "three versions ago" to "two versions > ago", editing it, and reapplying: > > git diff HEAD~2 HEAD~3 > the_patch > $EDITOR the_patch > git apply the_patch > git commit # ... > > Cheers, > Wincent > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/haml?hl=en -~----------~----~----~----~------~----~------~--~---
