Re: Really beginner on Version Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]