{"thread":{"id":"27609","subject":"Git pull --rebase with strategy ours doesn't work (possibly bug)","startedAt":"2011-06-13T03:05:31Z","lastAt":"2011-06-13T15:01:37Z","messageCount":5,"participants":["Dmitry S. Kravtsov","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"169910","messageId":"BANLkTi=jLQf6Wp-qqYoy7kND2M1=WRyxXg@mail.gmail.com","threadId":"27609","inReplyTo":null,"subject":"Git pull --rebase with strategy ours doesn't work (possibly bug)","fromName":"Dmitry S. Kravtsov","fromEmail":"idkravitz@gmail.com","sentAt":"2011-06-13T03:05:31Z","receivedAt":"2011-06-13T03:05:31Z","isPatch":false,"sender":{"key":"idkravitz@gmail.com","avatar":"https://gravatar.com/avatar/6f2f8e0e5eb02e84138927ffb9b2edbc750b4c44cab9270bdc01bd318d8783da?d=mp&s=160"},"body":"Hi,\n\nSo here the steps to reproduce:\n\n$ git init A\nInitialized empty Git repository in /home/catsadmin/git-test/A/.git/\n$ (cd A && echo 123 > file && git add file && git commit -m \"1st\")\n[master (root-commit) 1055edf] 1st\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 file\n$ git clone A B\nCloning into B...\ndone.\n$ git clone A C\nCloning into C...\ndone.\n$ (cd B && echo 333 >file && git commit -am \"2nd\")\n[master 4e9cd67] 2nd\n 1 files changed, 1 insertions(+), 1 deletions(-)\n$ (cd A && git pull ~/git-test/B master)\nremote: Counting objects: 5, done.\nremote: Total 3 (delta 0), reused 0 (delta 0)\nUnpacking objects: 100% (3/3), done.\nFrom /home/catsadmin/git-test/B\n * branch            master     -> FETCH_HEAD\nUpdating 1055edf..4e9cd67\nFast-forward\n file |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n$ (cd C && echo 111 > file && git commit -am \"3rd\")\n[master 1c4a368] 3rd\n 1 files changed, 1 insertions(+), 1 deletions(-)\n$ cd C\n$ git push origin master\nTo /home/catsadmin/git-test/A\n ! [rejected]        master -> master (non-fast-forward)\nerror: failed to push some refs to '/home/catsadmin/git-test/A'\nTo prevent you from losing history, non-fast-forward updates were rejected\nMerge the remote changes (e.g. 'git pull') before pushing again.  See the\n'Note about fast-forwards' section of 'git push --help' for details.\n\nSo my idea is to create a straight line history, that will look like\n\"1st\"---\"2nd\"---\"3rd\",\nand from git-rebase man page I read, that strategy ours allows us to\ndiscard conflicing changes in favor\nof ours.\n\n$ git pull --rebase -s ours origin master\nremote: Counting objects: 5, done.\nremote: Total 3 (delta 0), reused 0 (delta 0)\nUnpacking objects: 100% (3/3), done.\nFrom /home/catsadmin/git-test/A\n * branch            master     -> FETCH_HEAD\nFirst, rewinding head to replay your work on top of it...\nAlready applied: 0001 3rd\n/usr/bin/git-rebase: line 157:\n/home/catsadmin/git-test/C/.git/rebase-merge/rewritten: Нет такого\nфайла или каталога\nAll done.\n\nThis message not only looks weird, it also discard my \"3rd\" commit\nfrom master tree:\n$ git branch\n* master\n$ git log\ncommit 4e9cd6730b1215b22b65fbcc6cbf87e331e5eb92\nAuthor: Your Name <you@example.com>\nDate:   Mon Jun 13 13:53:27 2011 +1100\n\n    2nd\n\ncommit 1055edf3618787ea53231ed6f4b00dfe571c8940\nAuthor: Your Name <you@example.com>\nDate:   Mon Jun 13 13:52:53 2011 +1100\n\n    1st\n\nAm I wrong at something?\n\n-- \nDmitry S. Kravtsov\n"},{"id":"169911","messageId":"BANLkTikYH9qG6YGEb4k=WMh97JHSJyN8cA@mail.gmail.com","threadId":"27609","inReplyTo":"BANLkTi=jLQf6Wp-qqYoy7kND2M1=WRyxXg@mail.gmail.com","subject":"Re: Git pull --rebase with strategy ours doesn't work (possibly bug)","fromName":"Dmitry S. Kravtsov","fromEmail":"idkravitz@gmail.com","sentAt":"2011-06-13T03:21:19Z","receivedAt":"2011-06-13T03:21:19Z","isPatch":false,"sender":{"key":"idkravitz@gmail.com","avatar":"https://gravatar.com/avatar/6f2f8e0e5eb02e84138927ffb9b2edbc750b4c44cab9270bdc01bd318d8783da?d=mp&s=160"},"body":"Excuse me for russian locale, the part with error in english locale:\n\nremote: Counting objects: 5, done.\nremote: Total 3 (delta 0), reused 0 (delta 0)\nUnpacking objects: 100% (3/3), done.\nFrom /home/kravitz/git-test/A\n * branch            master     -> FETCH_HEAD\nFirst, rewinding head to replay your work on top of it...\nAlready applied: 0001 3rd\n/usr/libexec/git-core/git-rebase: line 157:\n/home/kravitz/git-test/C/.git/rebase-merge/rewritten: No such file or\ndirectory\nAll done.\nkravitz@Vor\n\n\n2011/6/13 Dmitry S. Kravtsov <idkravitz@gmail.com>:\n> Hi,\n>\n> So here the steps to reproduce:\n>\n> $ git init A\n> Initialized empty Git repository in /home/catsadmin/git-test/A/.git/\n> $ (cd A && echo 123 > file && git add file && git commit -m \"1st\")\n> [master (root-commit) 1055edf] 1st\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n>  create mode 100644 file\n> $ git clone A B\n> Cloning into B...\n> done.\n> $ git clone A C\n> Cloning into C...\n> done.\n> $ (cd B && echo 333 >file && git commit -am \"2nd\")\n> [master 4e9cd67] 2nd\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n> $ (cd A && git pull ~/git-test/B master)\n> remote: Counting objects: 5, done.\n> remote: Total 3 (delta 0), reused 0 (delta 0)\n> Unpacking objects: 100% (3/3), done.\n> From /home/catsadmin/git-test/B\n>  * branch            master     -> FETCH_HEAD\n> Updating 1055edf..4e9cd67\n> Fast-forward\n>  file |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n> $ (cd C && echo 111 > file && git commit -am \"3rd\")\n> [master 1c4a368] 3rd\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n> $ cd C\n> $ git push origin master\n> To /home/catsadmin/git-test/A\n>  ! [rejected]        master -> master (non-fast-forward)\n> error: failed to push some refs to '/home/catsadmin/git-test/A'\n> To prevent you from losing history, non-fast-forward updates were rejected\n> Merge the remote changes (e.g. 'git pull') before pushing again.  See the\n> 'Note about fast-forwards' section of 'git push --help' for details.\n>\n> So my idea is to create a straight line history, that will look like\n> \"1st\"---\"2nd\"---\"3rd\",\n> and from git-rebase man page I read, that strategy ours allows us to\n> discard conflicing changes in favor\n> of ours.\n>\n> $ git pull --rebase -s ours origin master\n> remote: Counting objects: 5, done.\n> remote: Total 3 (delta 0), reused 0 (delta 0)\n> Unpacking objects: 100% (3/3), done.\n> From /home/catsadmin/git-test/A\n>  * branch            master     -> FETCH_HEAD\n> First, rewinding head to replay your work on top of it...\n> Already applied: 0001 3rd\n> /usr/bin/git-rebase: line 157:\n> /home/catsadmin/git-test/C/.git/rebase-merge/rewritten: Нет такого\n> файла или каталога\n> All done.\n>\n> This message not only looks weird, it also discard my \"3rd\" commit\n> from master tree:\n> $ git branch\n> * master\n> $ git log\n> commit 4e9cd6730b1215b22b65fbcc6cbf87e331e5eb92\n> Author: Your Name <you@example.com>\n> Date:   Mon Jun 13 13:53:27 2011 +1100\n>\n>    2nd\n>\n> commit 1055edf3618787ea53231ed6f4b00dfe571c8940\n> Author: Your Name <you@example.com>\n> Date:   Mon Jun 13 13:52:53 2011 +1100\n>\n>    1st\n>\n> Am I wrong at something?\n>\n> --\n> Dmitry S. Kravtsov\n>\n\n\n\n-- \nDmitry S. Kravtsov\n"},{"id":"169912","messageId":"BANLkTinoaznfBQo3ruPP9C8JfMV5E2v_Fw@mail.gmail.com","threadId":"27609","inReplyTo":"BANLkTikYH9qG6YGEb4k=WMh97JHSJyN8cA@mail.gmail.com","subject":"Re: Git pull --rebase with strategy ours doesn't work (possibly bug)","fromName":"Dmitry S. Kravtsov","fromEmail":"idkravitz@gmail.com","sentAt":"2011-06-13T03:41:56Z","receivedAt":"2011-06-13T03:41:56Z","isPatch":false,"sender":{"key":"idkravitz@gmail.com","avatar":"https://gravatar.com/avatar/6f2f8e0e5eb02e84138927ffb9b2edbc750b4c44cab9270bdc01bd318d8783da?d=mp&s=160"},"body":"Also I read that during rebase terms ours and theirs are swapped, but\nit i change strategy to theirs it's still error, but even more\ncryptic:\n\nremote: Counting objects: 5, done.\nremote: Total 3 (delta 0), reused 0 (delta 0)\nUnpacking objects: 100% (3/3), done.\nFrom /home/kravitz/git-test/A\n * branch            master     -> FETCH_HEAD\nFirst, rewinding head to replay your work on top of it...\n/usr/libexec/git-core/git-rebase: line 117: git-merge-theirs: command not found\nUnknown exit code (127) from command: git-merge-theirs\n1a3b9bcbc737728ae997368d6d850a6a265681b7^ -- HEAD\n1a3b9bcbc737728ae997368d6d850a6a265681b7\n\n2011/6/13 Dmitry S. Kravtsov <idkravitz@gmail.com>:\n> Excuse me for russian locale, the part with error in english locale:\n>\n> remote: Counting objects: 5, done.\n> remote: Total 3 (delta 0), reused 0 (delta 0)\n> Unpacking objects: 100% (3/3), done.\n> From /home/kravitz/git-test/A\n>  * branch            master     -> FETCH_HEAD\n> First, rewinding head to replay your work on top of it...\n> Already applied: 0001 3rd\n> /usr/libexec/git-core/git-rebase: line 157:\n> /home/kravitz/git-test/C/.git/rebase-merge/rewritten: No such file or\n> directory\n> All done.\n> kravitz@Vor\n>\n>\n> 2011/6/13 Dmitry S. Kravtsov <idkravitz@gmail.com>:\n>> Hi,\n>>\n>> So here the steps to reproduce:\n>>\n>> $ git init A\n>> Initialized empty Git repository in /home/catsadmin/git-test/A/.git/\n>> $ (cd A && echo 123 > file && git add file && git commit -m \"1st\")\n>> [master (root-commit) 1055edf] 1st\n>>  1 files changed, 1 insertions(+), 0 deletions(-)\n>>  create mode 100644 file\n>> $ git clone A B\n>> Cloning into B...\n>> done.\n>> $ git clone A C\n>> Cloning into C...\n>> done.\n>> $ (cd B && echo 333 >file && git commit -am \"2nd\")\n>> [master 4e9cd67] 2nd\n>>  1 files changed, 1 insertions(+), 1 deletions(-)\n>> $ (cd A && git pull ~/git-test/B master)\n>> remote: Counting objects: 5, done.\n>> remote: Total 3 (delta 0), reused 0 (delta 0)\n>> Unpacking objects: 100% (3/3), done.\n>> From /home/catsadmin/git-test/B\n>>  * branch            master     -> FETCH_HEAD\n>> Updating 1055edf..4e9cd67\n>> Fast-forward\n>>  file |    2 +-\n>>  1 files changed, 1 insertions(+), 1 deletions(-)\n>> $ (cd C && echo 111 > file && git commit -am \"3rd\")\n>> [master 1c4a368] 3rd\n>>  1 files changed, 1 insertions(+), 1 deletions(-)\n>> $ cd C\n>> $ git push origin master\n>> To /home/catsadmin/git-test/A\n>>  ! [rejected]        master -> master (non-fast-forward)\n>> error: failed to push some refs to '/home/catsadmin/git-test/A'\n>> To prevent you from losing history, non-fast-forward updates were rejected\n>> Merge the remote changes (e.g. 'git pull') before pushing again.  See the\n>> 'Note about fast-forwards' section of 'git push --help' for details.\n>>\n>> So my idea is to create a straight line history, that will look like\n>> \"1st\"---\"2nd\"---\"3rd\",\n>> and from git-rebase man page I read, that strategy ours allows us to\n>> discard conflicing changes in favor\n>> of ours.\n>>\n>> $ git pull --rebase -s ours origin master\n>> remote: Counting objects: 5, done.\n>> remote: Total 3 (delta 0), reused 0 (delta 0)\n>> Unpacking objects: 100% (3/3), done.\n>> From /home/catsadmin/git-test/A\n>>  * branch            master     -> FETCH_HEAD\n>> First, rewinding head to replay your work on top of it...\n>> Already applied: 0001 3rd\n>> /usr/bin/git-rebase: line 157:\n>> /home/catsadmin/git-test/C/.git/rebase-merge/rewritten: Нет такого\n>> файла или каталога\n>> All done.\n>>\n>> This message not only looks weird, it also discard my \"3rd\" commit\n>> from master tree:\n>> $ git branch\n>> * master\n>> $ git log\n>> commit 4e9cd6730b1215b22b65fbcc6cbf87e331e5eb92\n>> Author: Your Name <you@example.com>\n>> Date:   Mon Jun 13 13:53:27 2011 +1100\n>>\n>>    2nd\n>>\n>> commit 1055edf3618787ea53231ed6f4b00dfe571c8940\n>> Author: Your Name <you@example.com>\n>> Date:   Mon Jun 13 13:52:53 2011 +1100\n>>\n>>    1st\n>>\n>> Am I wrong at something?\n>>\n>> --\n>> Dmitry S. Kravtsov\n>>\n>\n>\n>\n> --\n> Dmitry S. Kravtsov\n>\n\n\n\n-- \nDmitry S. Kravtsov\n"},{"id":"169914","messageId":"BANLkTik6Vdf9OF+t_=Ze8kFKFKTYvZKGyg@mail.gmail.com","threadId":"27609","inReplyTo":"BANLkTinoaznfBQo3ruPP9C8JfMV5E2v_Fw@mail.gmail.com","subject":"Re: Git pull --rebase with strategy ours doesn't work (possibly bug)","fromName":"Dmitry S. Kravtsov","fromEmail":"idkravitz@gmail.com","sentAt":"2011-06-13T03:50:36Z","receivedAt":"2011-06-13T03:50:36Z","isPatch":false,"sender":{"key":"idkravitz@gmail.com","avatar":"https://gravatar.com/avatar/6f2f8e0e5eb02e84138927ffb9b2edbc750b4c44cab9270bdc01bd318d8783da?d=mp&s=160"},"body":"So, while I still don't understand, why we got this errors I also\nfound that my task is accomplished by using recursive strategy and\ntheirs option.\n\n2011/6/13 Dmitry S. Kravtsov <idkravitz@gmail.com>:\n> Also I read that during rebase terms ours and theirs are swapped, but\n> it i change strategy to theirs it's still error, but even more\n> cryptic:\n>\n> remote: Counting objects: 5, done.\n> remote: Total 3 (delta 0), reused 0 (delta 0)\n> Unpacking objects: 100% (3/3), done.\n> From /home/kravitz/git-test/A\n>  * branch            master     -> FETCH_HEAD\n> First, rewinding head to replay your work on top of it...\n> /usr/libexec/git-core/git-rebase: line 117: git-merge-theirs: command not found\n> Unknown exit code (127) from command: git-merge-theirs\n> 1a3b9bcbc737728ae997368d6d850a6a265681b7^ -- HEAD\n> 1a3b9bcbc737728ae997368d6d850a6a265681b7\n>\n> 2011/6/13 Dmitry S. Kravtsov <idkravitz@gmail.com>:\n>> Excuse me for russian locale, the part with error in english locale:\n>>\n>> remote: Counting objects: 5, done.\n>> remote: Total 3 (delta 0), reused 0 (delta 0)\n>> Unpacking objects: 100% (3/3), done.\n>> From /home/kravitz/git-test/A\n>>  * branch            master     -> FETCH_HEAD\n>> First, rewinding head to replay your work on top of it...\n>> Already applied: 0001 3rd\n>> /usr/libexec/git-core/git-rebase: line 157:\n>> /home/kravitz/git-test/C/.git/rebase-merge/rewritten: No such file or\n>> directory\n>> All done.\n>> kravitz@Vor\n>>\n>>\n>> 2011/6/13 Dmitry S. Kravtsov <idkravitz@gmail.com>:\n>>> Hi,\n>>>\n>>> So here the steps to reproduce:\n>>>\n>>> $ git init A\n>>> Initialized empty Git repository in /home/catsadmin/git-test/A/.git/\n>>> $ (cd A && echo 123 > file && git add file && git commit -m \"1st\")\n>>> [master (root-commit) 1055edf] 1st\n>>>  1 files changed, 1 insertions(+), 0 deletions(-)\n>>>  create mode 100644 file\n>>> $ git clone A B\n>>> Cloning into B...\n>>> done.\n>>> $ git clone A C\n>>> Cloning into C...\n>>> done.\n>>> $ (cd B && echo 333 >file && git commit -am \"2nd\")\n>>> [master 4e9cd67] 2nd\n>>>  1 files changed, 1 insertions(+), 1 deletions(-)\n>>> $ (cd A && git pull ~/git-test/B master)\n>>> remote: Counting objects: 5, done.\n>>> remote: Total 3 (delta 0), reused 0 (delta 0)\n>>> Unpacking objects: 100% (3/3), done.\n>>> From /home/catsadmin/git-test/B\n>>>  * branch            master     -> FETCH_HEAD\n>>> Updating 1055edf..4e9cd67\n>>> Fast-forward\n>>>  file |    2 +-\n>>>  1 files changed, 1 insertions(+), 1 deletions(-)\n>>> $ (cd C && echo 111 > file && git commit -am \"3rd\")\n>>> [master 1c4a368] 3rd\n>>>  1 files changed, 1 insertions(+), 1 deletions(-)\n>>> $ cd C\n>>> $ git push origin master\n>>> To /home/catsadmin/git-test/A\n>>>  ! [rejected]        master -> master (non-fast-forward)\n>>> error: failed to push some refs to '/home/catsadmin/git-test/A'\n>>> To prevent you from losing history, non-fast-forward updates were rejected\n>>> Merge the remote changes (e.g. 'git pull') before pushing again.  See the\n>>> 'Note about fast-forwards' section of 'git push --help' for details.\n>>>\n>>> So my idea is to create a straight line history, that will look like\n>>> \"1st\"---\"2nd\"---\"3rd\",\n>>> and from git-rebase man page I read, that strategy ours allows us to\n>>> discard conflicing changes in favor\n>>> of ours.\n>>>\n>>> $ git pull --rebase -s ours origin master\n>>> remote: Counting objects: 5, done.\n>>> remote: Total 3 (delta 0), reused 0 (delta 0)\n>>> Unpacking objects: 100% (3/3), done.\n>>> From /home/catsadmin/git-test/A\n>>>  * branch            master     -> FETCH_HEAD\n>>> First, rewinding head to replay your work on top of it...\n>>> Already applied: 0001 3rd\n>>> /usr/bin/git-rebase: line 157:\n>>> /home/catsadmin/git-test/C/.git/rebase-merge/rewritten: Нет такого\n>>> файла или каталога\n>>> All done.\n>>>\n>>> This message not only looks weird, it also discard my \"3rd\" commit\n>>> from master tree:\n>>> $ git branch\n>>> * master\n>>> $ git log\n>>> commit 4e9cd6730b1215b22b65fbcc6cbf87e331e5eb92\n>>> Author: Your Name <you@example.com>\n>>> Date:   Mon Jun 13 13:53:27 2011 +1100\n>>>\n>>>    2nd\n>>>\n>>> commit 1055edf3618787ea53231ed6f4b00dfe571c8940\n>>> Author: Your Name <you@example.com>\n>>> Date:   Mon Jun 13 13:52:53 2011 +1100\n>>>\n>>>    1st\n>>>\n>>> Am I wrong at something?\n>>>\n>>> --\n>>> Dmitry S. Kravtsov\n>>>\n>>\n>>\n>>\n>> --\n>> Dmitry S. Kravtsov\n>>\n>\n>\n>\n> --\n> Dmitry S. Kravtsov\n>\n\n\n\n-- \nDmitry S. Kravtsov\n"},{"id":"169945","messageId":"7v8vt5rd0u.fsf@alter.siamese.dyndns.org","threadId":"27609","inReplyTo":"BANLkTi=jLQf6Wp-qqYoy7kND2M1=WRyxXg@mail.gmail.com","subject":"Re: Git pull --rebase with strategy ours doesn't work (possibly bug)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-13T15:01:37Z","receivedAt":"2011-06-13T15:01:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Dmitry S. Kravtsov\" <idkravitz@gmail.com> writes:\n\n> and from git-rebase man page I read, that strategy ours allows us to\n> discard conflicing changes in favor\n> of ours.\n\nThat is not what the \"ours\" strategy is about. When merging another\nhistory into our history, the strategy marks the other history \"merged\"\nwhile using our tree as the result of the merge, without using _anything_\nfrom their history.\n\nIt is not a way to take whatever that happen to merge cleanly textually\nbut use our change in only the conflicting parts.  You are probably\nconfusing it with 'ours' option of the recursive strategy, that is used in\n\"git merge -Xours\".\n"}]}