0

I would like to know which is the best approach for doing this. I'm curently working on a new design, the old design is still in production and a few bugs came up. So I decided to create a new branch called "old" and fix the bugs there so I can upload the fixes without breaking the design. What happens when the new design is ready and I want the fixes to be applied to the master branch? Which branch merges into which? How do I tell git which files to merge? I don't get it. Thanks.

EDIT: What I think I need is to commit changes in the old branch and replicate them in the master branch. Is that possible?

demian85
  • 2,394
  • 3
  • 20
  • 20

2 Answers2

1

You can do it in two way, merging or rebasing

for merging

git checkout master

git merge old

then everying in the old branch will be in master branch. but for the old branch, it doesn't have all the things in the master branch if you want to keep 2 branches in sync , you need to

git checkout old

git merge master

TheOneTeam
  • 25,806
  • 45
  • 116
  • 158
  • That's not what I need, if I merge the old into the new one, the old files will replace the new ones? WTF? I guess I will just checkout the correct files one by one into the master branch. – demian85 Nov 08 '11 at 14:54
  • I think cherry-pick is what you're looking for. – Marco Nov 08 '11 at 21:29
0

You need to checkout master Branch (where you developed the new design) and merge "old" into your branch you have checkout.

In case you just want specifig file(s) you may ether use checkout from other branch or cherry-pick a commit.

checkout from other branch: see the accepted answer from this so question

cherry-pick: see the accepted answer from this so question

Community
  • 1
  • 1
scube
  • 1,931
  • 15
  • 21
  • But that will replace the new files with the old ones! I want to replace only javascript files that changed... – demian85 Nov 08 '11 at 14:12