Besen, David <david.besen <at>> writes:

> Hi folks,
> I think one of my coworkers has stumbled on a git bug -- if you amend a 
merge commit, and then pull, your amends
> are lost.
> Is this expected behavior?
> I've reproduced the problem in a script (attached).  I ran it against a 
couple of versions of git (1.7.1,
> 1.7.9, 1.8.4, 2.0.0) and in each case it seemed to lose the amend.
> - Dave
> Attachment ( application/octet-stream, 1061 bytes

Whoops, accidentally encoded the script, here it is inline:


set -ex

if [ -z "$GIT" ]; then GIT=git; fi

# Clean up from the last run
rm -rf repo.git repo repo2 || :

# Set up a bare "remote" repo
$GIT init --bare repo.git

# Check out the "remote" repo
$GIT clone repo.git repo

# Add a commit
cd repo
echo "file" > file.txt
$GIT add file.txt
$GIT commit -m "Add file.txt"
$GIT push origin master

# Make a branch
$GIT checkout -b mybranch

# Add a commit on the branch
echo "mybranch" >> file.txt
$GIT add .
$GIT commit -m "Add 'mybranch' line"

# Go back to master
$GIT checkout master

# Merge in mybranch to create a merge commit
$GIT merge --no-ff mybranch

# Push that back
$GIT push

# Amend the merge commit
echo "amended" >> file.txt
$GIT add .
$GIT commit -C HEAD --amend

cd ..

# Make a second checkout
$GIT clone repo.git repo2
cd repo2

# Add some unrelated changes to be pulled
echo "repo2" > file2.txt
$GIT add .
$GIT commit -m "Add file2"
$GIT push

cd ..
cd repo

# Pull
$GIT pull --rebase

# Now, we expect the text "amended" to be in file.txt
grep amended file.txt

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to