git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: FernandoBasso <FernandoBasso.br@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Really beginner on Version Control
Date: Tue, 21 Sep 2010 16:35:26 -0700 (PDT)	[thread overview]
Message-ID: <m3mxrak937.fsf@localhost.localdomain> (raw)
In-Reply-To: <1285080133451-5555023.post@n2.nabble.com>

FernandoBasso <FernandoBasso.br@gmail.com> writes:

> I am really a beginner in. Bear with me please.
> 
> Why do we merge, say a testing branch into the master branch ? What
> is the use of it ?

Short answer: to make it visible.  Usually only a specific set of
branches is published.

Long answer: the real question is why we should use topic branches.
The answer is to keep unfinished code separate and not visible untill
it is finished and ready to be shown.  

You create new [private] branch for developing a feature, 'testing' in
your example, develop code on it, and when code is ready you make it
visible by putting it on 'master' branch.  One of possibilities is to
merge 'testing' branch into 'master'.  Then people can use those
changes taking / fetching from a 'master' branch.
 
> 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.  You are on current
('master') branch, and you are creating state of the new [merge]
commit.

Edit files, add those files after resolving conflict, then run 'git
commit' which would notice that you were in conflicted merge and do
the right thing.

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

No, if there is merge conflict you edit the files so they make sense,
incorporating your changes made on 'testing' branch with the changes
that were made on 'master' branch since branching point (merge base)
of 'testing' and 'master'.

Branches would merge without conflict if:

1. You did the changes on 'testing', while 'master' didn't move at all.
   This is so called "fast-forward" case and wouldn't even create merge
   conflict without --no-ff option.

2. Changes on 'testing' and on 'master' (since merge base) touch
   different files.  This is so called "trivial" merge (tree level
   merge to be more exact).

3. Changes on 'testing' and on 'master' touch different areas of
   files, so that textual 3-way merge succeeds.

HTH
-- 
Jakub Narebski
Poland
ShadeHawk on #git

  parent reply	other threads:[~2010-09-21 23: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 [this message]
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
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=m3mxrak937.fsf@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=FernandoBasso.br@gmail.com \
    --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).