From: Dmitry Potapov <dpotapov@gmail.com>
To: Thomas Anderson <zelnaga@gmail.com>
Cc: Tait <git.git@t41t.com>, git@vger.kernel.org
Subject: Re: a few beginner git questions
Date: Sun, 7 Mar 2010 11:50:02 +0300 [thread overview]
Message-ID: <20100307085002.GA31105@dpotapov.dyndns.org> (raw)
In-Reply-To: <15b345f1003062102l22ac2d2fn3ed5b73221bf4216@mail.gmail.com>
On Sat, Mar 06, 2010 at 11:02:20PM -0600, Thomas Anderson wrote:
>
> How, then, do I update code? ie. I perform my initial clone, make
> some changes and commit / push them. Someone else then comes along,
> makes some changes and commits them. The next day, I do Remote ->
> Fetch from -> origin to update my code to the latest in Git but
> c:\git\test\clone\README is exactly the same as it was before. How do
> I update the initial clone such that I can edit the updated files?
There are a few ways to do that. It depends on what you actually wants.
First of all, you can merge 'origin/master' (or whatever its name).
If you do not have any local commit then merge will just fast-forward
your branch to the same point. However, if you do have changes, then
it will create a new merge commit. If you have many such merge commits,
it can make the upstream unhappy, because your changes are intervene
with merges, so it is more difficult to inspect your actual changes.
Another option is to rebase your changes on top of the 'origin/master'.
Rebasing your changes on top origin/master is more close to what happens
when you do 'cvs update' does, except that in git you rebase committed
changes, so if something goes wrong during this process, you can abort
and redo it again. So, all your work will not be lost. The advantage of
'rebase' is that you have a clean and linear history. The disadvantage
is that you re-write all your commits, so you should not do that on
"published" history. Also, re-writing may introduce a problem even if
rebased had no conflict. While merge may also produced a non-working
result, 'merge' preserves the original history while rebase produces a
new one, which is not tested. So, I would not recommend to rebase any
long series of patches or anything non-trivial unless it is absolutely
necessary.
Finally, a typical workflow with Git is to use feature branches. You
create a new branch to implement some feature, do all your work on it
(without any "update") and then merge it to the upstream (either you
merge and push the result or send a pull request to the maintainer).
After your changes have been merged, you just delete this branch. For
each new work, you start a new branch from the current origin/master.
Dmitry
next prev parent reply other threads:[~2010-03-07 8:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-06 6:42 a few beginner git questions Thomas Anderson
2010-03-06 7:01 ` Allan Wind
2010-03-06 7:05 ` Tait
2010-03-07 2:23 ` Thomas Anderson
2010-03-07 9:08 ` Dmitry Potapov
2010-03-07 5:02 ` Thomas Anderson
2010-03-07 8:50 ` Dmitry Potapov [this message]
2010-03-08 18:55 ` Tait
2010-03-07 9:39 ` Junio C Hamano
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=20100307085002.GA31105@dpotapov.dyndns.org \
--to=dpotapov@gmail.com \
--cc=git.git@t41t.com \
--cc=git@vger.kernel.org \
--cc=zelnaga@gmail.com \
/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).