Search code examples
gitmergerebasevimdiffvim-fugitive

Git Flow Feature Creation and Rebasing Features


I have 2 branches, development and master. I want to create a new feature on the development branch so I do:

git flow feature start test_01

Which creates a feature branch and switches to this branch. For testing reasons I switch to the development branch and edit file read_me.markdown. I commit this change and push it.

I switch back to the feature branch and edit the same read_me.markdown file on the same line to spark a merge conflict. To finish the feature I do:

git flow feature finish test_01 -r (so it rebases the feature branch)

Now a conflict occurs I fix it using vimdiff with vim-fugitive. I start vimdiff and do “:ls” I pick the remote branch to use. Next I do ":diffget 4" followed by ":diffupdate " and next I just write the file and quit everything “:wqa”

Now the conflict is fixed and a merge occurred and I just simply push my changes.

THE PROBLEM: when doing this I go look at Github for mac tool and see that there are no conflicts and no changes. But when I switch over(checkout) to the master branch and back to the develop branch I get that same merge conflict again?

So I’m wondering what is wrong in my way of working.

Thanks a lot for the help

UPDATE1) The Github tool conflict:

Auto-merging README.markdown
CONFLICT (content): Merge conflict in README.markdown
 (1)

UPDATE2) Tried without rebase same error, no error when checking out the branch only in the Github Tool

UPDATE3)

1) git flow feature start test

2) do changes to develop -> so I can spark a conflict

3) do changes to feature

4) git rebase feature develop

5) Fix changes -> When I want to commit it says “No changes - did you forget to use 'git add’?”

6) git checkout develop

7) git merge feature -> STILL HAVE Merge Conflict on Develop branch

UPDATE4) More Details

1) I am on a new branch develop

2) git flow init

3) git flow feature start enhancement1 -> Feature branch is created

4) git checkout develop

4.1) in File readme.md I add “testtesttest” and commit my work

4.2) tig status

4.2) I set the file readme.md to “changes to be committed”

4.3) I commit this files

4.4) Committed as “commit on develop branch”

5) git checkout feature/enhancement1

5.1) in File readme.md I add “xxxxxxxxx” and commit my work

5.2) tig status

5.2) I set the file readme.md to “changes to be committed”

5.3) I commit this files

5.4) Committed as “commit on feature branch”

6) git rebase feature/enhancement1 develop

First, rewinding head to replay your work on top of it...
Applying: Commit on Develop Branch
Using index info to reconstruct a base tree...
M   README.md
Falling back to patching base and 3-way merge...
Auto-merging README.md
CONFLICT (content): Merge conflict in README.md
Failed to merge in the changes.
Patch failed at 0001 Commit on Develop Branch
The copy of the patch that failed is found in:
   /Users/Vincent/Documents/featureconflicts/.git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

7) I now have a conflict I will fix it setting the file to the condition of 5.1 (in File readme.md I add “xxxxxxxxx” )

8) Fixed the conflict

9) Did git rebase --skip

10) Switches to my develop branch

11) git flow feature finish enhancement

--> Now everything works great. So it was rebase --skip that was needed.


Solution

  • So the clue to this story was, if conflict occurs:

    -> and changes of both branches are needed to be kept - git rebase --continue -> if change of only the feature needs to be kept - git rebase --skip