git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git merge strange result

From
CBCatalin(ux) M. BOIE <catab@embedromix.ro>
Date
Dec 1, 2011, 15:36 UTC
Message-ID
<alpine.LFD.2.02.1112011733070.32682@mail.embedromix.ro>
Hello!

Below is a script that reproduce what a coleague of mine found. Seems that if in a branch we have a commit that is cherry-picked be master, than revert that commit in branch and merge branch in master, the revert is ignored. Is it normal?

Thank you very much!
#!/bin/bash
set -e

rm -rf buba1 mkdir buba1 cd buba1

git init echo -e "aaa\nbbb\nccc" > file1 git add file1 git commit -m "c1"

echo "Create branch b1..." git branch b1 echo

echo "Create a bad fix..." sed --in-place -e 's/bbb/bad line/' file1 git add file1 git commit -m "bad commit" cat file1 echo

echo "Cherry pick on b1..." git checkout b1 git cherry-pick -x master echo

echo "Reverting on b1" git revert --no-edit b1 echo

echo "Switch to master" git checkout master echo

echo "merge-base is `git merge-base --all master b1 | git name-rev --stdin`" echo

echo "diff between master and b1..." git diff master b1 echo

echo "Merge b1 in master" git merge --verbose --log b1

if [ "`grep bad file1`" = "" ]; then
 	echo "good!"
else
 	echo "bad!"
fi
# it should prind "good"

-- Catalin(ux) M. BOIE http://kernel.embedromix.ro/

Next: Jeff King
Message 1 of 2 in “git merge strange result”
  1. Catalin(ux) M. BOIEDec 1, 2011
  2. Jeff KingDec 1, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.