Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Re-applying git commit

I had a commit with a pull-request already merged in the development branch. Then after a weak someone made a mistake and merged the master branch back to the development and somehow, i don't know how, but my already merged commit is now gone from the development branch.

I can track down the commits to dev branch after my commit, and I could track down where it went wrong, but the PR for the commit which broke/erased my merged commit doesn't show my files as if it would be changed by that commit.

Long story short, some code got reverted to an old state by a commit and there are no signs of it, how can I re-apply a commit to the dev branch?

like image 647
Jim-Y Avatar asked Sep 08 '26 10:09

Jim-Y


1 Answers

You just need to find the commit sha-1 value that you made the changes, and then cherry-pick this commit to your development branch:

git checkout development
git cherry-pick <commit you found>
like image 59
Marina Liu Avatar answered Sep 11 '26 03:09

Marina Liu