19

I'm using bitbucket and sourcetree and I've done this:

I have a develop branch. From this branch I have created a feature branch.

After creating I have fix some errors on develop branch and push it to this branch only.

How can I have these fixes in the feature branch? I think I have to merge develop branch into feature branch but I'm not sure because I'm new in git and I don't want to do something wrong that makes me lose develop branch. but now I want to have these fixes on my feature branch.

What do I have to do?

VansFannel
  • 41,682
  • 96
  • 329
  • 561

2 Answers2

23

You want to bring changes from development branch to feature branch. So first switch to feature branch and merge development branch into it. In case you want the commits from develop branch too, use the non fast forward merge --no-ff approach. Else do not use --no-ff.

git checkout feature
git merge --no-ff develop

As you are merging develop branch into feature branch, stay assured that develop branch will remain untouched. You may get merge conflicts in feature branch which can be easily solved following the steps on this link: http://softwarecave.org/2014/03/03/git-how-to-resolve-merge-conflicts/

Aditya Kadakia
  • 969
  • 5
  • 9
7

Yes you can merge or preferably rebase develop in your feature.

git checkout feature
git rebase develop

If you get merge errors you can skip rebase by

git rebase --skip

or solve the conflicts and continue with (after adding your solution):

git rebase --continue

Also see this question

Community
  • 1
  • 1
LcKjus
  • 101
  • 6