git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Hochstein <thh@inter.net>
To: git@vger.kernel.org
Subject: Re: Really beginner on Version Control
Date: Wed, 22 Sep 2010 09:31:50 +0200	[thread overview]
Message-ID: <gcvg.1009220931.2922@thorondor.akallabeth.de> (raw)
In-Reply-To: 1285114417273-5557145.post@n2.nabble.com

FernandoBasso schrieb:

> For instance, I have 'hello' in line 2 of site.php in the master branch. I
> go to the  testing branch, edit site.php, change 'hello' for 'world' at the
> same line, commit and got back to master. I merge testing into master and I
> get no conflicts. Shouldn't it conflict ? 

No.

You have changed "hello" to world in your testing branch. When you
merge your testing branch back to your master branch, git will apply
all changes you made in testing to master. That's not a problem in
that case, as master was not changed since testing was branched from
it.

Another example:

You create a testing branch from master. Now you'll go to your testing
branch, change "hello" to "world", commit, go back to your master
branch and change "hello" to "all" there (and commit). Now you'll get
a conflict when trying to merge your testing branch - git will try to
apply the change from testing (i.e. change "hello" to "world"), but
can't to that as "hello" was already changed to "all" in your master
branch. git doesn't know which of this conflicting [1] changes is the
right one you'll want to keep, so you have to tell it.

Merging a branch into master will make git try to apply all changes
that you made in this branch to the master branch. That's easy if
master didn't change since you created your testing branch from it.
It's also easy if master _did_ change, but never at the same places as
in testing. You'll only get a conflict if you change the same line(s)
in master _and_ in testing.

Regards,
-thh

[1] That's why it's called a conflict.

  parent reply	other threads:[~2010-09-22  7:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-21 14:42 Really beginner on Version Control FernandoBasso
2010-09-21 14:59 ` Thomas Moulard
2010-09-21 14:59 ` Enrico Weigelt
2010-09-24 19:33   ` Eric Raible
2010-09-24 20:18     ` Enrico Weigelt
2010-09-24 21:25     ` FernandoBasso
2010-09-21 16:40 ` Andreas Ericsson
2010-09-21 23:35 ` Jakub Narebski
2010-09-22  0:13   ` FernandoBasso
2010-09-22  3:52     ` Andrew Keller
2010-09-22 11:45       ` FernandoBasso
2010-09-22 11:49         ` FernandoBasso
2010-09-22 12:50           ` Tor Arntsen
2010-09-22 22:15         ` Dmitry Potapov
2010-09-22  7:31     ` Thomas Hochstein [this message]
2010-09-22 22:13     ` Dmitry Potapov
2010-09-22 22:10 ` Dmitry Potapov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gcvg.1009220931.2922@thorondor.akallabeth.de \
    --to=thh@inter.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).