Understanding git flow process

110 views Asked by At

I just recently started using git flow but I am running into issue all the time. I believe I do not fully understand the process of merging a feature. I am running into merge conflicts all the time and getting errors that my develop and origin/develop have diverged. This is my process...

I want to make changes to develop, so I create a feature...

git flow feature start MYFEATURE

Now I am in feature MYFEATURE locally. So I make the changes I want and I git add then git commit then git push to my MYFEATURE.

Now I want to merge my feature to develop but in the meantime, other devs have pushed to develop branch so mine is not up to date. So to update it I do...

git pull origin develop

This gives me lots of conflicts, so I fix them and then I git push. At this point I try to merge my feature and I get more errors, my steps must be wrong.

Anyways then I do...

git flow feature finish MYFEATURE

and it tells me my local is ahead by x commits, so I do,

 git push

Can someone show me the right process of doing this, step-by-step? I think I am not entirely sure how this is working.

1

There are 1 answers

0
Sajib Khan On BEST ANSWER

After pulling develop branch into MYFEATURE, push the changes to remote. Then checkout develop branch, pull MYFEATURE into develop, then push to remote.

$ git fetch
$ git checkout MYFEATURE
$ git pull origin develop
# fix conflicts if occur

$ git push origin MYFEATURE
# now remote/MYFEATURE has MYFEATURE + develop changes

# merge MYFEATURE with develop
$ git checkout develop
$ git pull origin develop
$ git pull origin MYFEATURE              # merge MYFEATURE branch
$ git push origin develop                
# push to remote, now develop has develop + MYFEATURE changes