I have a git history that looks like this. Is it possible (and how would I) to merge the changes made in commit 5 (in unrelated files than commits 3 and 4) onto commit 2?
CodePudding user response:
You need to:
- Create a branch off of Commit 2
- Cherry-pick Commit 5 into that new branch
If the hash for Commit 2 is a84212677 and the hash for Commit 5 is 2677a8421, then you'd do the following:
> git co a84212677
> git co -b newbranch
> git cherry-pick 2677a8421
Your Git repo would then look like this: