Re: Really beginner on Version Control

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

 



On Tue, Sep 21, 2010 at 6:42 PM, FernandoBasso
<FernandoBasso.br@xxxxxxxxx> wrote:
>
> Why do we merge, say a testing branch into the master branch ? What is the
> use of it ?

We usually don't do that, because it goes against recommended git workflows
http://www.kernel.org/pub/software/scm/git/docs/gitworkflows.html

With Git, you typically merge your stable branch to to your main
development branch or you merge some feature branch to master if you
consider it to be mature enough to be included in the next release.

> When there is a conflict when merging branches (merging the testing into the
> current branch), should I edit the 'current' branch or the 'testing' branch

You edit files in your working directory to resolve conflicts, after
you commit the result to your current branch.

> Should both branches have exactly the same code so that they can be merged
> without conflicts ?

No... There are different merging strategies, and Git is flexible enough
to allow you to specify your own merging strategy for some files. The
default merging strategy relies on the context to find if there is any
conflict. It means that the same file has been edited around the same
place (around the same line), then it will generate a conflict.

There is one important thing to keep in mind when it comes to merges.
Merge conflict are your friends and not your enemies. In other words,
they warn you about changes to some files that can contradict each
other, so you need to use your brain to resolve them gracefully.
Usually, they do pretty good job at that, but in some rare cases, merge
without any merge conflict can produce unworkable code. So, after any
non-trivial merge, you should do testing. If testing reveals some
problem then you should correct them. Git allows you amend any last
commit (including the merge commit) using:

git commit --amend

If two branches are diverged a long time ago, it is very useful to look
at history of those branches to find what changes caused the conflict.
You can do that using the following command:

gitk --merge

or if you are interested only in one particular file then:

gitk --merge this-file


Dmitry
--
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]