tags:

views:

43

answers:

2

Hi

I'm fairly new to Git, and have been working with it for only 3 months. We previously migrated our repositories from SVN.

I'd like to be able to merge changes from the master into my dev branch without getting "normal merge" conflicts that require "git mergetool", just so I can inspect a change that could have been merged without special notification.

It may just be my previous SVN background, and an expectation that does not carry to Git, but I remember in SVN that I could merge a change from one branch to another, and it only required special attention if there was actually a merge conflict.

In Git, I'm finding I have to do "git mergetool" because any changes in the master always seem to result in a normal merge conflict, even though there are no actual merge conflicts.

Currently, I pull changes from the master, and merge into the dev branch as follows:

$ git checkout master
$ git pull
$ git checkout dev
$ git merge master
... [do normal merge conflict thing]
$ git -a commit # though usually this is done via the gui, so I'm not sure of the exact command
$ git push

Am I doing something wrong, or missing a config for merges that would be relatively straight forward in SVN, or are my expectations not appropriate for Git?

A: 

i think you want to rebase instead of merge.

i always do

#on my master
git fetch origin
git rebase origin/master
git checkout mybranch
git rebase master

if you have any uncommitted changes you want to preserve, you can stash them and then after pop them. its been a while since ive used git (man i miss it) but that routine worked well for me

hvgotcodes
rebasing is a great tool, but you don't want to do that if your dev branch is shared or previously published. From the Pro Git Book: "Do not rebase commits that you have pushed to a public repository."
Bryce
Rebases are definitely out, since the dev branch is also pushed to as origin/dev
Reuben
A: 

What you're doing looks like it should work fine. I'm guessing it's somewhere else in the process causing the problem. Having a better idea of what you do to get changes into the master branch might help. Are you doing anything like in the master branch merging from dev but selectively backing out some changes?

Karl Bielefeldt
Perhaps line feeds are different or something, leading to conflicts.
igorw
Sometimes changes into the master are a cherry-pick from a completely different branch (unfortunately, I still have a hangover from the original SVN migration).
Reuben