reverting a commit in git
Nov. 11th, 2022 09:54 amIn case anyone else finds this useful (and so I can easily look it up again later):
If you've already deployed a commit that you need to revert, you can get the changes you need in two quick steps:
1. git log -1 -p [sha] > [txtfile]
2. git apply --reverse [txtfile]
Then add and commit as normal.
In my case, I needed to back out two commits. Just make sure you apply the reversion for the newer commit first.
Also, hi! Since my last post here about Docker, I eventually wandered away from my attempts to get a Dreamwidth development container suite working. A DW install has a lot of moving parts that need to be able to communicate with each other, so my efforts to keep all the various services properly separated in their own individual containers quickly grew unwieldy. I might come back to that project at a later date, but for now I'm using a cloud provider to run my own development system on dw.kareila.net.
If you've already deployed a commit that you need to revert, you can get the changes you need in two quick steps:
1. git log -1 -p [sha] > [txtfile]
2. git apply --reverse [txtfile]
Then add and commit as normal.
In my case, I needed to back out two commits. Just make sure you apply the reversion for the newer commit first.
Also, hi! Since my last post here about Docker, I eventually wandered away from my attempts to get a Dreamwidth development container suite working. A DW install has a lot of moving parts that need to be able to communicate with each other, so my efforts to keep all the various services properly separated in their own individual containers quickly grew unwieldy. I might come back to that project at a later date, but for now I'm using a cloud provider to run my own development system on dw.kareila.net.