git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* A bug in git merge
@ 2018-03-27  9:53 Orgad Shaneh
  2018-03-27 12:49 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: Orgad Shaneh @ 2018-03-27  9:53 UTC (permalink / raw)
  To: git

Hi,

If I cherry-pick a commit that added a line, then merge another commit
which removes this line, the line remains in the file instead of being
removed.

The following script demonstrates the bug.

file should be equivalent on both branches

git init
seq 1 20 > file
git add file
git commit -m 'Initial'
sed -i "s/^5/5\n55/" file
git commit -a -m 'Added 55'
git checkout -b other HEAD^
git cherry-pick master
git commit --amend --author 'Author <a@b.c>' --no-edit # generate a new hash
sed -i '/55/d' file
git commit -a -m 'Removed 55'
git checkout master
git merge --no-edit other
git diff other # Should be equal

- Orgad

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-27 12:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-27  9:53 A bug in git merge Orgad Shaneh
2018-03-27 12:49 ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).