On Sat, May 26, 2012 at 7:16 AM, Xiaofan Chen wrote:
> On Thu, May 24, 2012 at 11:39 PM, Pete Batard wrote:
>> This one should work a bit better.
>>
>
> Let me try to use this as an exercise to learn how to revert the
> existing v1 patch and then apply this v2 patch.
>
>> On 2012.05.24 14:17, Xiaofan Chen wrote:
>>> One git question first, how to revert the v2 patch and then apply
>>> this patch?
>>
>> If you just applied a patch, "git reset HEAD" should do the job... I
>> think (I'd have to look up the command, since with TGit I'm just doing
>> that in a couple of clicks by accessing the log).
>
> It does not seem to work.

To remove the latest commit in your own git tree, run
 git reset --hard HEAD^
This resets the tree to the current 2nd commit (HEAD is a short for
the top commit, HEAD^ is second, HEAD^^ us third, etc.).

(On the other hand if the commit has already been pushed to a public
repo, you should not change it. Then you have to *add* a reverting
commit with "git revert".)

BTW, if you for example want to remove the second last commit and keep
the last one, you have several options:
1. Remove the two commits, then cherry-pick the last one (refer to it
by commit id, it is still in the git repo but not attached to any
head).
2. Use git rebase -i HEAD^^ and change the order of the two commits,
then git reset --hard HEAD^ to drop the last one.

FYI, git reset without --hard does not reset the files, only removes
the commit action. So it can for instance be used to split the last
commit into several commits, by selectively adding changes to each new
commit with "git add" (per file) or "git add -p" (per hunk).

Regards,
Tormod

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to