You can use the "git revert" command to commit the specified commit with the undo changes.
git revert commit id
When do you use git revert?
Git has a history of commits, and you may want to keep that history and undo past changes.
In such cases, you can use the "git revert" command to commit with changes that undo past changes.
You can get more git revert back
Yes You can revert the revert by specifying the "git revert" commit ID.
What to do if there are multiple consecutive changes?
Find out the commit ID and run "git revert" multiple times, from newest to oldest. It's a hassle, but when you need to do it, you have to do it.
git revert commit 3 git revert commit 2 git revert commit 1
It's a mistake-prone procedure, so it's safe to create a branch with the " git branch" command instead of doing it in the master branch.