Re-applying previous commits in Git

If a new commit somehow overrides the changes from a previous commit, then you can re-apply the previous commit over the current one by using the cherry-pick command.

First, find the hash of the commit you want to re-apply, then apply it.

git log
git cherry-pick hash