{"thread":{"id":"29252","subject":"Git beginner - Need help understanding","startedAt":"2011-12-27T03:12:17Z","lastAt":"2011-12-28T08:05:07Z","messageCount":6,"participants":["chirin","Dov Grobgeld","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"181708","messageId":"1324955537875-7129186.post@n2.nabble.com","threadId":"29252","inReplyTo":null,"subject":"Git beginner - Need help understanding","fromName":"chirin","fromEmail":"takonatto@gmail.com","sentAt":"2011-12-27T03:12:17Z","receivedAt":"2011-12-27T03:12:17Z","isPatch":false,"sender":{"key":"takonatto@gmail.com","avatar":null},"body":"I'm just beginning to use Git in my workplace, and (rather shamefully) have\nnever heard of Git until now. While I pore over the stacks of documentations\nfor beginners, could someone help me understand this issue I've been having? \n\nEvery time a colleague updates a file, I would not be able to pull due to\nmerge conflicts - even though I have never made any changes to the\nrepository. I'd try  and then  again, but it would still give the same merge\nconflict. The only way I could pull currently is to do a git commit (even\nwithout changes), and then git pull.\n\nIf this was SVN, I could simply resolve this with Update. What am I missing,\nand what should I be looking for?\n\nThanks in advance..\n\n--\nView this message in context: http://git.661346.n2.nabble.com/Git-beginner-Need-help-understanding-tp7129186p7129186.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"181710","messageId":"CA++fsGHPKhzfd7-KohOZ4WpYatx_-EW0bjq46zwswbu8TomHCg@mail.gmail.com","threadId":"29252","inReplyTo":"CA++fsGGEv=jS4YNEUCxTwZ3pZc7HbbmoPbDH+MamrqamxrsADA@mail.gmail.com","subject":"Re: Git beginner - Need help understanding","fromName":"Dov Grobgeld","fromEmail":"dov.grobgeld@gmail.com","sentAt":"2011-12-27T06:34:34Z","receivedAt":"2011-12-27T06:34:34Z","isPatch":false,"sender":{"key":"dov.grobgeld@gmail.com","avatar":"https://gravatar.com/avatar/b74b57a9ce04ef5f356927856e125f1e70e7ce38772c5b8793b854b830f0fe6c?d=mp&s=160"},"body":"The best way of understanding and also of asking questions, is if you\ncan reproduce the steps of exactly what you want and don't understand\nby a sequence of commands like so:\n\n     # First create a bare repository\n     mkdir R\n     cd R\n     git init --bare .\n\n     # Clone it into A\n     git clone R A\n\n     # Clone it into B\n     git clone R B\n\n     # Now start doing changes for A and B, pulling and pushing into R\n     cd A\n     echo \"Change #1\" > hello.txt\n     git add hello.txt\n     git commit -m 'Commit #1'\n     git push origin master\n\n     # Get into B\n     cd ../B\n     git pull\n     echo \"Change #2\" >> hello.txt\n     git commit -a -m 'Commit #2'\n     git push\n\n     # Get into A and pull the changes done by B\n     cd ../A\n     git pull\n\nIn this sequence, which fulfills the scenario that you described,\nthere are no conflicts. So I suggest that you try to change the\ncommand sequence to illustrate what you don't understand and ask\nagain.\n\n Regards,\n Dov\n\n\n\n On Tue, Dec 27, 2011 at 05:12, chirin <takonatto@gmail.com> wrote:\n>\n> I'm just beginning to use Git in my workplace, and (rather shamefully) have\n> never heard of Git until now. While I pore over the stacks of documentations\n> for beginners, could someone help me understand this issue I've been having?\n>\n> Every time a colleague updates a file, I would not be able to pull due to\n> merge conflicts - even though I have never made any changes to the\n> repository. I'd try  and then  again, but it would still give the same merge\n> conflict. The only way I could pull currently is to do a git commit (even\n> without changes), and then git pull.\n>\n> If this was SVN, I could simply resolve this with Update. What am I missing,\n> and what should I be looking for?\n>\n> Thanks in advance..\n>\n> --\n> View this message in context: http://git.661346.n2.nabble.com/Git-beginner-Need-help-understanding-tp7129186p7129186.html\n> Sent from the git mailing list archive at Nabble.com.\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"181712","messageId":"1324969372444-7129429.post@n2.nabble.com","threadId":"29252","inReplyTo":"CA++fsGHPKhzfd7-KohOZ4WpYatx_-EW0bjq46zwswbu8TomHCg@mail.gmail.com","subject":"Re: Git beginner - Need help understanding","fromName":"chirin","fromEmail":"takonatto@gmail.com","sentAt":"2011-12-27T07:02:52Z","receivedAt":"2011-12-27T07:02:52Z","isPatch":false,"sender":{"key":"takonatto@gmail.com","avatar":null},"body":"From what I understand, your scenario is exactly what I expect. Which is why\nwhen I asked around my colleagues, no one was able to explain why I'm having\nthis issue.\n\nAs per your scenario:\n\n    # A changes hello.txt\n\n    # Going into B (who has not done anything to hello.txt)\n    git pull --> merge conflict on hello.txt\n\n    git commit\n    git pull --> OK\n\nWould going through Gerrit have anything to do with it? I've compared git\nconfig -l with the others but they are the same (aside from\nremote.origin.url which has our own gerrit userid).\n\n\n\nDov Grobgeld wrote\n> \n> The best way of understanding and also of asking questions, is if you\n> can reproduce the steps of exactly what you want and don't understand\n> by a sequence of commands like so:\n> \n>      # First create a bare repository\n>      mkdir R\n>      cd R\n>      git init --bare .\n> \n>      # Clone it into A\n>      git clone R A\n> \n>      # Clone it into B\n>      git clone R B\n> \n>      # Now start doing changes for A and B, pulling and pushing into R\n>      cd A\n>      echo \"Change #1\" > hello.txt\n>      git add hello.txt\n>      git commit -m 'Commit #1'\n>      git push origin master\n> \n>      # Get into B\n>      cd ../B\n>      git pull\n>      echo \"Change #2\" >> hello.txt\n>      git commit -a -m 'Commit #2'\n>      git push\n> \n>      # Get into A and pull the changes done by B\n>      cd ../A\n>      git pull\n> \n> In this sequence, which fulfills the scenario that you described,\n> there are no conflicts. So I suggest that you try to change the\n> command sequence to illustrate what you don't understand and ask\n> again.\n> \n>  Regards,\n>  Dov\n> \n\n--\nView this message in context: http://git.661346.n2.nabble.com/Git-beginner-Need-help-understanding-tp7129186p7129429.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"181727","messageId":"7vr4zp7q15.fsf@alter.siamese.dyndns.org","threadId":"29252","inReplyTo":"1324969372444-7129429.post@n2.nabble.com","subject":"Re: Git beginner - Need help understanding","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-12-27T19:50:14Z","receivedAt":"2011-12-27T19:50:14Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"chirin <takonatto@gmail.com> writes:\n\n> From what I understand, your scenario is exactly what I expect. Which is why\n> when I asked around my colleagues, no one was able to explain why I'm having\n> this issue.\n>\n> As per your scenario:\n>\n>     # A changes hello.txt\n>\n>     # Going into B (who has not done anything to hello.txt)\n>     git pull --> merge conflict on hello.txt\n>\n>     git commit\n>     git pull --> OK\n\nThis is quite different from what Dov showed as \"the right way to\nreport\". Dob's recipe begins from absolutely empty state and creates three\nrepositories involved with exact sequence and anybody can reproduce how it\nis supposed to work (or break). It was written in such a way that you can\ntry to follow the sequence to see if you see a behaviour that is different\nfrom Dob expects (in which case your machine, filesystem or the Git binary\nyou installed might be the culprit). Have you tried it?\n\nCompared to that, your version above does not say anything about what the\nstate of A, B and the repository A and B interact with were in before the\nproblem started, so even if Dob wanted to help you by trying to reproduce\nyour situation, there is not enough information to do so.\n\n>> In this sequence, which fulfills the scenario that you described,\n>> there are no conflicts. So I suggest that you try to change the\n>> command sequence to illustrate what you don't understand and ask\n>> again.\n\nExactly.\n"},{"id":"181743","messageId":"1325036313909-7131536.post@n2.nabble.com","threadId":"29252","inReplyTo":"7vr4zp7q15.fsf@alter.siamese.dyndns.org","subject":"Re: Git beginner - Need help understanding","fromName":"chirin","fromEmail":"takonatto@gmail.com","sentAt":"2011-12-28T01:38:33Z","receivedAt":"2011-12-28T01:38:33Z","isPatch":false,"sender":{"key":"takonatto@gmail.com","avatar":null},"body":"The problem was solved by using another Gerrit ID for remote.origin.url in\nthe config. I remain confused with Git. \n\n\nJunio C Hamano wrote\n> \n> Compared to that, your version above does not say anything about what the\n> state of A, B and the repository A and B interact with were in before the\n> problem started, so even if Dob wanted to help you by trying to reproduce\n> your situation, there is not enough information to do so.\n> \n\nMy apologies on being vague.. I'm here for learning purpose instead of\nget-someone-to-help-me-solve purpose. :P I'm really keen on learning what to\nlook for, where to start looking to understand Git.\n\nI'm having difficulties providing information that I do not yet know how to,\nas I'm still at the stage where I'm studying simple terminologies like\norigin, master, etc. and I tend to confuse myself more by comparing it to\nSVN.\n\nWhat should I know about the 'states of A, B and the repository A and B\ninteract with'? \n\n--\nView this message in context: http://git.661346.n2.nabble.com/Git-beginner-Need-help-understanding-tp7129186p7131536.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"181746","messageId":"CA++fsGHWrc12G9rHTYOuM0yVpKn_NY9tF3oiKCkXUk0vCgHauQ@mail.gmail.com","threadId":"29252","inReplyTo":"1325036313909-7131536.post@n2.nabble.com","subject":"Re: Git beginner - Need help understanding","fromName":"Dov Grobgeld","fromEmail":"dov.grobgeld@gmail.com","sentAt":"2011-12-28T08:05:07Z","receivedAt":"2011-12-28T08:05:07Z","isPatch":false,"sender":{"key":"dov.grobgeld@gmail.com","avatar":"https://gravatar.com/avatar/b74b57a9ce04ef5f356927856e125f1e70e7ce38772c5b8793b854b830f0fe6c?d=mp&s=160"},"body":"I'm glad to hear that your problem was solved.\n\nOn Wed, Dec 28, 2011 at 03:38, chirin <takonatto@gmail.com> wrote:\n> [stuff deleted]\n> What should I know about the 'states of A, B and the repository A and B\n> interact with'?\n\nThe state of a repository are most easily described by the sequence of\ncommands done to it from its creation.  The best way of learning and\nsolving problems is trying to reproduce them with the minimum amount\nof steps. I.e. even if you are using a GUI tool for your convenience,\nyou should be familiar with the command line tools, since that is the\nbest way of conveying what you have done. My motto is: \"Don't describe\nin human language what you have done, but show me the exact\ncommands!\". And there is no language better for such than the exact\ncommand line.\n\nRegards,\nDov\n>\n> --\n> View this message in context: http://git.661346.n2.nabble.com/Git-beginner-Need-help-understanding-tp7129186p7131536.html\n> Sent from the git mailing list archive at Nabble.com.\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"}]}