0

So I want to bring only commits from another repository branch to my local branch. How can I do that or can i do that using cherry-pick?

So i tried merging two branches but it brought unrelated histories as well

Ben_96
  • 20
  • 3
  • What do you mean by "bring only commits"? All Git *has* is commits, really (well, and tags). – torek Dec 14 '22 at 03:46

1 Answers1

1

If you only want to have certain commits on your branch from another branch, then git cherry-pick is the way to go. This will pick the changes onto your branch, but be aware, that this will create a "new commit" (with the same source changes, but with different meta data like a different commit hash). So if you want to merge these two branches later, it will be show twice in your history.

Cheesi
  • 483
  • 4
  • 14