public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
From: Tim Moore <timoore@redhat.com>
To: frysk <frysk@sourceware.org>
Subject: git pull vs git rebase
Date: Sat, 27 Oct 2007 17:48:00 -0000	[thread overview]
Message-ID: <472379E9.4050806@redhat.com> (raw)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm glad to see everyone git-ing away. The tip of the master branch is looking a bit
convoluted with merges, so I thought I might remind you of the difference between
"git pull" and "git rebase". Your tree has to be up-to-date with respect to the remote
master branch before you push, so it's natural to "git pull" after you've made local
commits in preparation for a push. Unfortunately this often results in a merge conflict,
especially with the ChangeLog files. So you resolve that, but then your pushed commits
include the merge commits, which confuses the history.

Instead, you can rebase your local commits to the tip of the master tree before doing
the push. "git fetch origin" updates your local copy of the remote branches on sourceware;
then "git rebase origin" will "replay" your local, new commits on top of the current
remote branch. If there are merge conflicts in this process you resolve them and continue
the "playback," but the resolution doesn't appear as a merge commit in the history. Now,
when you push your new work, it's all clean; no merges in sight.

So, read the man page on "git-rebase" and give it a try.

Tim

- --
Red Hat France SARL, 171 Avenue Georges Clemenceau
92024 Nanterre Cedex, France.
Siret n° 421 199 464 00056
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFHI3npeDhWHdXrDRURArAkAJ0U8/1PlKuwGbFCUTtPloAhzhjBAQCeL0Q9
2+47vugUbDmr7a7d2V6EHOc=
=vCsu
-----END PGP SIGNATURE-----

             reply	other threads:[~2007-10-27 17:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-27 17:48 Tim Moore [this message]
2007-10-29 18:58 ` Sami Wagiaalla

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=472379E9.4050806@redhat.com \
    --to=timoore@redhat.com \
    --cc=frysk@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).