Re: [Q] merge squash unexpected conflicts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Using git 1.6.3.1, when using "git merge --squash" I get unexpected
conflicts when merging an update to a file that was added after the
original branch point, like this

  * Initialize git repo
  * Add hello to master
  * Create topic branch
  * Add goodbye to master
  * Merge squash master into topic, gets new goodbye
  * Update goodbye in master
  * Again merge squash master into topic, update goodbye

The second merge squash produces a conflict in goodbye.

Am I doing something a little wrong or unexpected?  Is there a way
around this squash conflict behavior?  This doesn't seem to happen
with plain merge without squash.  I've appended a small bash script to
show this behavior - run it from an empty directory.

Thanks,
Cory


#!/bin/sh

try() {
    echo "$@"
    "$@" || exit 1
}

note() {
    echo
    echo "##" "$@" "##"
}

[ -d .git ] && echo .git already exists, aborting. && exit 1

note "Initialize git repo"
try git init

note "Add hello to master"
echo "hello world" > hello.txt
try git add hello.txt
try git commit -m "Added hello"

note "Create topic branch"
try git checkout -b topic

note "Add goodbye to master"
try git checkout master
echo "farewell world" > goodbye.txt
try git add goodbye.txt
try git commit -m "Added goodbye"

note "Merge master into topic, gets new goodbye"
try git checkout topic
try git merge --squash master
try git commit -m "Merged master"

note "Update goodbye in master"
try git checkout master
echo "goodbye world" > goodbye.txt
try git add goodbye.txt
try git commit -m "Updated goodbye"

note "Again merge master into topic, update goodbye"
try git checkout topic
try git merge --squash master
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]