I have a git branch that is based off an old master. This branch has commits on it that the master does not have. I want to update the branch with the master’s code, but keep the commits on the branch. What’s the best way to do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Basically you first download all the updates for the remotes (without merging them), then you checkout to your branch and merge the updated master into your branch. If the master branch you are talking about is in the local repository and is updated, simple
git checkout your_branch; git merge masterwill do the trick (will merge changes from master into your branch).