My team is planning to switch from Perforce to Git and I am trying to find a way to make Git ignore pom version differences between branches. This works well in Perforce and I'm not having any luck reproducing the behavior with Git.
Here are my steps:
Checkout parent branch
ndeckard@ws /c/dev/proj/testgit (master) $ git checkout release/1.0 Switched to branch 'release/1.0' Your branch is up-to-date with 'origin/release/1.0'.Create child branch from it
ndeckard@ws /c/dev/proj/testgit (release/1.0) $ git branch branch/FEA-650Switch over to new branch
ndeckard@ws /c/dev/proj/testgit (release/1.0) $ git checkout branch/FEA-650 Switched to branch 'branch/FEA-650'Update child branch pom version
<version>1.0.0-FEA-650-SNAPSHOT</version>Add it and commit
ndeckard@ws /c/dev/proj/testgit (branch/FEA-650) $ git status On branch branch/FEA-650 Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: pom.xml no changes added to commit (use "git add" and/or "git commit -a") ndeckard@ws /c/dev/proj/testgit (branch/FEA-650) $ git add pom.xml ndeckard@ws /c/dev/proj/testgit (branch/FEA-650) $ git commit -m "set feature branch pom version" [branch/FEA-650 59e156e] set feature branch pom version 1 file changed, 1 insertion(+), 1 deletion(-)Switch back to parent branch
ndeckard@ws /c/dev/proj/testgit (branch/FEA-650) $ git checkout release/1.0 Switched to branch 'release/1.0' Your branch is up-to-date with 'origin/release/1.0'.Merge child branch into parent auto-accepting parent branch version (using the “ours” merge strategy)
ndeckard@ws /c/dev/proj/testgit (release/1.0) $ git merge branch/FEA-650 -s ours Merge made by the 'ours' strategy.Attempt 2nd merge of child into parent (Already up-to-date.) Good. This is what I want
ndeckard@ws /c/dev/proj/testgit (release/1.0) $ git merge branch/FEA-650 Already up-to-date.Checkout child and merge parent into child (it fast forwards and sticks the parent branches pom version on the child). Not good. I need it to say "already up-to-date" like above and keep the child branch pom version as it already is on the child branch
ndeckard@ws /c/dev/proj/testgit (release/1.0) $ git checkout branch/FEA-650 Switched to branch 'branch/FEA-650' ndeckard@ws /c/dev/proj/testgit (branch/FEA-650) $ git merge release/1.0 Updating 59e156e..2f3a2a0 Fast-forward pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
After step 7, I would like merges in either direction between parent and child to say (Already up-to-date.)
Is there a way with Git to make future merges ignore the version number difference in the pom file between branches?