Charlie,

You may have not used the correct terms, so I will answer two different 
questions.

1: You want to add new commits to a branch which is not master (or maybe, even 
to a new branch).
In this case you should use the 'checkout <branch>' command to checkout the 
other named branch; or use 'checkout -b <newname>' if you want a new branch 
starting with your current location (or read the manual for other variations). 
Now you are on the named barnch you can do your changes, add them, and commit 
them, as required.

2: You already have some commits on branch_1, and you want to merge them into 
another branch called branch_2 (and neither is master, but you currently are on 
master).
In this case you first decide which way (direction) the 'into' is going, and 
hence the branch name you want to finish on (you may have to talk to an 
upstream maintainer to check what they want). 

I will assume you have branch_work and branch_fix and you would like _work to 
have the _fix. 
So (as 1. above) 'git checkout branch_work' to start at the right place. Then 
`git merge branch_fix` (check the manual for you merge message options, and how 
to fix conflicts). You should now still be on 'branch_work', but it will have a 
merge commit bringing in the branch_fix changes.

Hope that helps.

Philip

  ----- Original Message ----- 
  From: Charlie Oehlrich 
  To: Git for human beings 
  Sent: Sunday, November 20, 2016 9:33 AM
  Subject: [git-users] merge commits in one branch


  i want to merge commits in one branch without affecting other branches and 
the branch i want to merge commits on is not master

  -- 
  You received this message because you are subscribed to the Google Groups 
"Git for human beings" group.
  To unsubscribe from this group and stop receiving emails from it, send an 
email to [email protected].
  For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to