git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Git beginner - Need help understanding
@ 2011-12-27  3:12 chirin
       [not found] ` <CA++fsGGEv=jS4YNEUCxTwZ3pZc7HbbmoPbDH+MamrqamxrsADA@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: chirin @ 2011-12-27  3:12 UTC (permalink / raw)
  To: git

I'm just beginning to use Git in my workplace, and (rather shamefully) have
never heard of Git until now. While I pore over the stacks of documentations
for beginners, could someone help me understand this issue I've been having? 

Every time a colleague updates a file, I would not be able to pull due to
merge conflicts - even though I have never made any changes to the
repository. I'd try  and then  again, but it would still give the same merge
conflict. The only way I could pull currently is to do a git commit (even
without changes), and then git pull.

If this was SVN, I could simply resolve this with Update. What am I missing,
and what should I be looking for?

Thanks in advance..

--
View this message in context: http://git.661346.n2.nabble.com/Git-beginner-Need-help-understanding-tp7129186p7129186.html
Sent from the git mailing list archive at Nabble.com.

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

* Re: Git beginner - Need help understanding
       [not found] ` <CA++fsGGEv=jS4YNEUCxTwZ3pZc7HbbmoPbDH+MamrqamxrsADA@mail.gmail.com>
@ 2011-12-27  6:34   ` Dov Grobgeld
  2011-12-27  7:02     ` chirin
  0 siblings, 1 reply; 6+ messages in thread
From: Dov Grobgeld @ 2011-12-27  6:34 UTC (permalink / raw)
  To: chirin; +Cc: git

The best way of understanding and also of asking questions, is if you
can reproduce the steps of exactly what you want and don't understand
by a sequence of commands like so:

     # First create a bare repository
     mkdir R
     cd R
     git init --bare .

     # Clone it into A
     git clone R A

     # Clone it into B
     git clone R B

     # Now start doing changes for A and B, pulling and pushing into R
     cd A
     echo "Change #1" > hello.txt
     git add hello.txt
     git commit -m 'Commit #1'
     git push origin master

     # Get into B
     cd ../B
     git pull
     echo "Change #2" >> hello.txt
     git commit -a -m 'Commit #2'
     git push

     # Get into A and pull the changes done by B
     cd ../A
     git pull

In this sequence, which fulfills the scenario that you described,
there are no conflicts. So I suggest that you try to change the
command sequence to illustrate what you don't understand and ask
again.

 Regards,
 Dov



 On Tue, Dec 27, 2011 at 05:12, chirin <takonatto@gmail.com> wrote:
>
> I'm just beginning to use Git in my workplace, and (rather shamefully) have
> never heard of Git until now. While I pore over the stacks of documentations
> for beginners, could someone help me understand this issue I've been having?
>
> Every time a colleague updates a file, I would not be able to pull due to
> merge conflicts - even though I have never made any changes to the
> repository. I'd try  and then  again, but it would still give the same merge
> conflict. The only way I could pull currently is to do a git commit (even
> without changes), and then git pull.
>
> If this was SVN, I could simply resolve this with Update. What am I missing,
> and what should I be looking for?
>
> Thanks in advance..
>
> --
> View this message in context: http://git.661346.n2.nabble.com/Git-beginner-Need-help-understanding-tp7129186p7129186.html
> Sent from the git mailing list archive at Nabble.com.
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Git beginner - Need help understanding
  2011-12-27  6:34   ` Dov Grobgeld
@ 2011-12-27  7:02     ` chirin
  2011-12-27 19:50       ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: chirin @ 2011-12-27  7:02 UTC (permalink / raw)
  To: git

From what I understand, your scenario is exactly what I expect. Which is why
when I asked around my colleagues, no one was able to explain why I'm having
this issue.

As per your scenario:

    # A changes hello.txt

    # Going into B (who has not done anything to hello.txt)
    git pull --> merge conflict on hello.txt

    git commit
    git pull --> OK

Would going through Gerrit have anything to do with it? I've compared git
config -l with the others but they are the same (aside from
remote.origin.url which has our own gerrit userid).



Dov Grobgeld wrote
> 
> The best way of understanding and also of asking questions, is if you
> can reproduce the steps of exactly what you want and don't understand
> by a sequence of commands like so:
> 
>      # First create a bare repository
>      mkdir R
>      cd R
>      git init --bare .
> 
>      # Clone it into A
>      git clone R A
> 
>      # Clone it into B
>      git clone R B
> 
>      # Now start doing changes for A and B, pulling and pushing into R
>      cd A
>      echo "Change #1" > hello.txt
>      git add hello.txt
>      git commit -m 'Commit #1'
>      git push origin master
> 
>      # Get into B
>      cd ../B
>      git pull
>      echo "Change #2" >> hello.txt
>      git commit -a -m 'Commit #2'
>      git push
> 
>      # Get into A and pull the changes done by B
>      cd ../A
>      git pull
> 
> In this sequence, which fulfills the scenario that you described,
> there are no conflicts. So I suggest that you try to change the
> command sequence to illustrate what you don't understand and ask
> again.
> 
>  Regards,
>  Dov
> 

--
View this message in context: http://git.661346.n2.nabble.com/Git-beginner-Need-help-understanding-tp7129186p7129429.html
Sent from the git mailing list archive at Nabble.com.

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

* Re: Git beginner - Need help understanding
  2011-12-27  7:02     ` chirin
@ 2011-12-27 19:50       ` Junio C Hamano
  2011-12-28  1:38         ` chirin
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2011-12-27 19:50 UTC (permalink / raw)
  To: chirin; +Cc: git

chirin <takonatto@gmail.com> writes:

> From what I understand, your scenario is exactly what I expect. Which is why
> when I asked around my colleagues, no one was able to explain why I'm having
> this issue.
>
> As per your scenario:
>
>     # A changes hello.txt
>
>     # Going into B (who has not done anything to hello.txt)
>     git pull --> merge conflict on hello.txt
>
>     git commit
>     git pull --> OK

This is quite different from what Dov showed as "the right way to
report". Dob's recipe begins from absolutely empty state and creates three
repositories involved with exact sequence and anybody can reproduce how it
is supposed to work (or break). It was written in such a way that you can
try to follow the sequence to see if you see a behaviour that is different
from Dob expects (in which case your machine, filesystem or the Git binary
you installed might be the culprit). Have you tried it?

Compared to that, your version above does not say anything about what the
state of A, B and the repository A and B interact with were in before the
problem started, so even if Dob wanted to help you by trying to reproduce
your situation, there is not enough information to do so.

>> In this sequence, which fulfills the scenario that you described,
>> there are no conflicts. So I suggest that you try to change the
>> command sequence to illustrate what you don't understand and ask
>> again.

Exactly.

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

* Re: Git beginner - Need help understanding
  2011-12-27 19:50       ` Junio C Hamano
@ 2011-12-28  1:38         ` chirin
  2011-12-28  8:05           ` Dov Grobgeld
  0 siblings, 1 reply; 6+ messages in thread
From: chirin @ 2011-12-28  1:38 UTC (permalink / raw)
  To: git

The problem was solved by using another Gerrit ID for remote.origin.url in
the config. I remain confused with Git. 


Junio C Hamano wrote
> 
> Compared to that, your version above does not say anything about what the
> state of A, B and the repository A and B interact with were in before the
> problem started, so even if Dob wanted to help you by trying to reproduce
> your situation, there is not enough information to do so.
> 

My apologies on being vague.. I'm here for learning purpose instead of
get-someone-to-help-me-solve purpose. :P I'm really keen on learning what to
look for, where to start looking to understand Git.

I'm having difficulties providing information that I do not yet know how to,
as I'm still at the stage where I'm studying simple terminologies like
origin, master, etc. and I tend to confuse myself more by comparing it to
SVN.

What should I know about the 'states of A, B and the repository A and B
interact with'? 

--
View this message in context: http://git.661346.n2.nabble.com/Git-beginner-Need-help-understanding-tp7129186p7131536.html
Sent from the git mailing list archive at Nabble.com.

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

* Re: Git beginner - Need help understanding
  2011-12-28  1:38         ` chirin
@ 2011-12-28  8:05           ` Dov Grobgeld
  0 siblings, 0 replies; 6+ messages in thread
From: Dov Grobgeld @ 2011-12-28  8:05 UTC (permalink / raw)
  To: chirin; +Cc: git

I'm glad to hear that your problem was solved.

On Wed, Dec 28, 2011 at 03:38, chirin <takonatto@gmail.com> wrote:
> [stuff deleted]
> What should I know about the 'states of A, B and the repository A and B
> interact with'?

The state of a repository are most easily described by the sequence of
commands done to it from its creation.  The best way of learning and
solving problems is trying to reproduce them with the minimum amount
of steps. I.e. even if you are using a GUI tool for your convenience,
you should be familiar with the command line tools, since that is the
best way of conveying what you have done. My motto is: "Don't describe
in human language what you have done, but show me the exact
commands!". And there is no language better for such than the exact
command line.

Regards,
Dov
>
> --
> View this message in context: http://git.661346.n2.nabble.com/Git-beginner-Need-help-understanding-tp7129186p7131536.html
> Sent from the git mailing list archive at Nabble.com.
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2011-12-28  8:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-27  3:12 Git beginner - Need help understanding chirin
     [not found] ` <CA++fsGGEv=jS4YNEUCxTwZ3pZc7HbbmoPbDH+MamrqamxrsADA@mail.gmail.com>
2011-12-27  6:34   ` Dov Grobgeld
2011-12-27  7:02     ` chirin
2011-12-27 19:50       ` Junio C Hamano
2011-12-28  1:38         ` chirin
2011-12-28  8:05           ` Dov Grobgeld

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).