michael
michael

Reputation: 110510

Merge multiple commits from my dev branch to my master branch?

I did the following in my git repository.

  1. git commit my changes
  2. create and checkout a dev branch
  3. git make 3 commits to the dev branch

My question is how can I take the 3 commits from my dev branch and merge to my master branch and append to commit #1?

Upvotes: 0

Views: 122

Answers (1)

user376507
user376507

Reputation: 2066

git checkout master followed by git merge dev

Note that the above will take all the changes in dev branch and put them into master. If you just want those selective 3 commits which you did in dev branch then you need to use git cherry-pick <commit_id>. Lets say you have those 3 commits with commit id's as commit_id1, commit_id2 and commit_id3 with commit_id3 being the latest commit, you need to execute the following commands

  1. git checkout master
  2. git cherry-pick commit_id1
  3. git cherry-pick commit_id2
  4. git cherry-pick commit_id3

Upvotes: 1

Related Questions