Git – Reapply changes that were accidentally rollback

  • fennng 

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

发表评论

您的电子邮箱地址不会被公开。