昨天,今天,明天,每天的每天,你是否都多懂得一点点...

星期四, 五月 24, 2018

Git - Reapply changes that were accidentally rollback

Here is the scenario

I made some changes and commit the file
I accidentally undo the change in my editor then made some more changes and commit
Now I realized the first change has been rollback.


Here is what I did

Find the finger print of my first change  a6dfb30, and find the original finger print  7c54b25, use the following command to generate the patch file


git diff  7c54b25 a6dfb30 -- src/app/dashboard/dashboard.component.html > 1.patch

Then apply the patch

git apply 1.patch

Done

--
Feng

没有评论:

其它博客地址

此博客的同步博客地址: http://fengnz.wordpress.com
这里进入我的MSN SPACE.