-2

I have committed some changes in one branch. Now I have to make the same changes in another branch.

Is there a way to get the previous commits to the current branch, so I can directly raise the pull request?

random
  • 9,774
  • 10
  • 66
  • 83
  • 3
    Try reading about `cherry-pick` – Tim Sep 09 '15 at 12:33
  • Tim is right; you're probably looking for `git cherry-pick`. See http://stackoverflow.com/questions/1241720/git-cherry-pick-vs-merge-workflow – jub0bs Sep 09 '15 at 12:34
  • If I know commit ID, How can I use cherry pick here? – user5251476 Sep 09 '15 at 13:17
  • 2
    possible duplicate of [What does cherry-picking a commit with git mean?](http://stackoverflow.com/questions/9339429/what-does-cherry-picking-a-commit-with-git-mean) – nwinkler Sep 09 '15 at 13:19

1 Answers1

1

Checkout the branch you want to have the commits in. Then merge the branch that has the commits: git checkout master

git merge fixes

I would give this a read. https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging

If you want to just apply selective commits, you should look into the git cherry-pick command. (http://git-scm.com/docs/git-cherry-pick)

Andy
  • 773
  • 2
  • 6
  • 22