1

When I am reading about merge, I see branch merges or merges with cherry-picking, but is there another way to merge one commit into a main branch. Here is my scenario.

I have a Mainline Branch where I have some changes. In the morning, I create a new branch TestBr off of MainLine and work on my own commits. When I commit something C1 in the afternoon, I want to merge C1 into Mainline. Shouldn't git merge command solve this without using cherry-picking. Or is get merge only for branch merges.

Thanks.

user3606175
  • 2,013
  • 1
  • 13
  • 16
  • `git cherry-pick` is what you want. `git merge` can't deal with commits.. only branches. This is a duplicate of http://stackoverflow.com/questions/881092/how-to-merge-a-specific-commit-in-git – ddavison Aug 19 '14 at 19:10
  • Thank you. I did read all those qns before asking this. I was trying to see if git merge can do this without cherry picking. – user3606175 Aug 19 '14 at 19:12
  • then the answer is no `:)` Do you have an issue using `git cherry-pick`? – ddavison Aug 19 '14 at 19:14
  • Not in general. I am a newbie to git so in the process of figuring it out I was wondering how pull requests work. Do they do merge on specific commit? Hence the question. I wish I had a someone whom I can ping on IM and ask all my questions. :) Thanks for looking. – user3606175 Aug 19 '14 at 19:22

1 Answers1

1

If you don't mind bringing over all of the commits from your branch TestBr then git merge will work. If you have other commits (e.g. C2, C3, etc) and only want commit C1, use git cherry-pick.

jstricker
  • 2,132
  • 1
  • 30
  • 44