{"thread":{"id":"49252","subject":"Git Unrelated Histories","startedAt":"2018-08-29T16:49:27Z","lastAt":"2018-08-29T20:22:17Z","messageCount":4,"participants":["Tomas Zubiri","Stefan Beller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"356854","messageId":"CAE3VKEp3PJLCy3tL=K51nNzGry-HySb57QHemZzMtg3RkBmzUw@mail.gmail.com","threadId":"49252","inReplyTo":null,"subject":"Git Unrelated Histories","fromName":"Tomas Zubiri","fromEmail":"me@tomaszubiri.com","sentAt":"2018-08-29T16:49:25Z","receivedAt":"2018-08-29T16:49:27Z","isPatch":false,"sender":{"key":"me@tomaszubiri.com","avatar":null},"body":"Hello all,\n\nI have recently joined a team there seems to be a couple of  issue\nwith the git repositories:\n\n\n1- A branch created from development cannot be merged into the\nproduction branch.\n\n\n\n(production)\n\ngit merge development_feature_branch\n\n\n\nfatal: refusing to merge unrelated histories\n\n\n\n\n2- If there is a file that only has a 1 line difference in production,\na git diff will return that the whole file is different:\n\ngit diff production:folder development:folder\n\n\n“\ndiff --git a/folder/file.py b/folder/file.py\n\nindex 9bfd6612..20cce520 100644\n\n--- a/folder/file py\n\n+++ b/folder/file.py\n\n@@ -1,245 +1,245 @@\n\n“\n\nI’m not 100% sure what happened here. But it seems that changes and\nadded files are copied and pasted into the production branch and\nuploaded indepenedently as separate files, contributing to a huge\ndifference between branches.\n\nHow can I confirm this hypothesis, and what steps can I take to solve it?\n\nThank you.\n"},{"id":"356866","messageId":"CAGZ79kakEYc954nQDThAZ0fSwbNp2-GGwthnevoQ4DxEUu4gZA@mail.gmail.com","threadId":"49252","inReplyTo":"CAE3VKEp3PJLCy3tL=K51nNzGry-HySb57QHemZzMtg3RkBmzUw@mail.gmail.com","subject":"Re: Git Unrelated Histories","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-08-29T18:15:33Z","receivedAt":"2018-08-29T18:15:48Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, Aug 29, 2018 at 9:49 AM Tomas Zubiri <me@tomaszubiri.com> wrote:\n>\n> Hello all,\n>\n> I have recently joined a team there seems to be a couple of  issue\n> with the git repositories:\n>\n>\n> 1- A branch created from development cannot be merged into the\n> production branch.\n>\n>\n>\n> (production)\n>\n> git merge development_feature_branch\n>\n>\n>\n> fatal: refusing to merge unrelated histories\n>\n\nSee the git merge man page for the\n  --allow-unrelated-histories switch.\n\n>\n>\n>\n> 2- If there is a file that only has a 1 line difference in production,\n> a git diff will return that the whole file is different:\n>\n> git diff production:folder development:folder\n>\n>\n> “\n> diff --git a/folder/file.py b/folder/file.py\n>\n> index 9bfd6612..20cce520 100644\n>\n> --- a/folder/file py\n>\n> +++ b/folder/file.py\n>\n> @@ -1,245 +1,245 @@\n>\n> “\n>\n> I’m not 100% sure what happened here. But it seems that changes and\n> added files are copied and pasted into the production branch and\n> uploaded indepenedently as separate files, contributing to a huge\n> difference between branches.\n\nIt sounds to me as if there would be line ending issues or some sort\nof whitespace issues (tab vs spaces).\n\n>\n> How can I confirm this hypothesis, and what steps can I take to solve it?\n\ngit diff --ignore-all-space\nor --ignore-space-at-eol\n\nLook at gitattributes to set your flavor for files so you don't have\nto pass these flags all the time\n\nStefan\n"},{"id":"356873","messageId":"CAE3VKErVQ9-PcQ-83xUqBDvLxNUDmWvhOAm4SMhqpQyAZCWQEg@mail.gmail.com","threadId":"49252","inReplyTo":"CAE3VKErGMSgB9gJAEnAuEDE51Yem6WUsg6fmOQELY1HCrALk_Q@mail.gmail.com","subject":"Fwd: Git Unrelated Histories","fromName":"Tomas Zubiri","fromEmail":"me@tomaszubiri.com","sentAt":"2018-08-29T20:18:49Z","receivedAt":"2018-08-29T20:19:14Z","isPatch":false,"sender":{"key":"me@tomaszubiri.com","avatar":null},"body":"Thank you for taking the time to help me Stefan\n\n\nOn Aug 29, 2018 15:15, \"Stefan Beller\" <sbeller@google.com> wrote:\n>\n> On Wed, Aug 29, 2018 at 9:49 AM Tomas Zubiri <me@tomaszubiri.com> wrote:\n> >\n> > Hello all,\n> >\n> > I have recently joined a team there seems to be a couple of  issue\n> > with the git repositories:\n> >\n> >\n> > 1- A branch created from development cannot be merged into the\n> > production branch.\n> >\n> >\n> >\n> > (production)\n> >\n> > git merge development_feature_branch\n> >\n> >\n> >\n> > fatal: refusing to merge unrelated histories\n> >\n>\n> See the git merge man page for the\n>   --allow-unrelated-histories switch.\n\nI have tried that switch, however when merging a small feature branch,\nthe merge tries to merge ALL of the differences between both branches,\nand they have diverged quite a long while ago.\nI am not getting the expected behaviour of just merging the changes\nfrom the feature branch.\n\ngit-merge-base shows a common ancestor from 2 months ago,  btw.\n\n\n>\n> >\n> >\n> >\n> > 2- If there is a file that only has a 1 line difference in production,\n> > a git diff will return that the whole file is different:\n> >\n> > git diff production:folder development:folder\n> >\n> >\n> > “\n> > diff --git a/folder/file.py b/folder/file.py\n> >\n> > index 9bfd6612..20cce520 100644\n> >\n> > --- a/folder/file py\n> >\n> > +++ b/folder/file.py\n> >\n> > @@ -1,245 +1,245 @@\n> >\n> > “\n> >\n> > I’m not 100% sure what happened here. But it seems that changes and\n> > added files are copied and pasted into the production branch and\n> > uploaded indepenedently as separate files, contributing to a huge\n> > difference between branches.\n>\n> It sounds to me as if there would be line ending issues or some sort\n> of whitespace issues (tab vs spaces).\n>\n> >\n> > How can I confirm this hypothesis, and what steps can I take to solve it?\n>\n> git diff --ignore-all-space\n> or --ignore-space-at-eol\n\nThis worked. Thank you!\n\n>\n> Look at gitattributes to set your flavor for files so you don't have\n> to pass these flags all the time\n>\n> Stefan\n"},{"id":"356874","messageId":"CAGZ79kZ1fcvBbJ9K+jw=wvCseSURSEKvnCDNFGsuZqcOfcZ7tQ@mail.gmail.com","threadId":"49252","inReplyTo":"CAE3VKErGMSgB9gJAEnAuEDE51Yem6WUsg6fmOQELY1HCrALk_Q@mail.gmail.com","subject":"Re: Git Unrelated Histories","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-08-29T20:13:52Z","receivedAt":"2018-08-29T20:22:17Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"+cc the mailing list\n\n> > >\n> > > git merge development_feature_branch\n> > > fatal: refusing to merge unrelated histories\n> > >\n> >\n> > See the git merge man page for the\n> >   --allow-unrelated-histories switch.\n>\n> I have tried that switch, however when merging a small feature branch,\n> the merge tries to merge ALL of the differences between both branches,\n> and they have diverged quite a long while ago.\n> I am not getting the expected behaviour of just merging the changes\n> from the feature branch.\n>\n> git-merge-base shows a common ancestor from 2 months ago,  btw.\n>\n"}]}