git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Dailey <rcdailey.lists@gmail.com>
To: Git <git@vger.kernel.org>
Subject: Process of updating a local branch from another with tracking
Date: Wed, 12 Feb 2014 15:55:01 -0600	[thread overview]
Message-ID: <CAHd499CQK7Mmd+vWb74Nj4usX8KhmurJNd31MrAMUs6Vb2zOOw@mail.gmail.com> (raw)

I have the following alias defined:
sync = "!f() { cbr=$(git rev-parse --abbrev-ref HEAD); git co $1 &&
git pull && git co $cbr && git rebase $1; }; f"

The goal is to basically update a local branch which tracks a branch
on a remote, and then rebase my local topic branch onto that updated
local branch.

I do this instead of just rebasing onto origin/master. Example:

git checkout master
git pull --rebase origin master
git checkout topic1
git rebase master

I could do this instead but not sure if it is recommended:

git checkout topic1
git fetch
git rebase origin/master

Any thoughts on the alias I created? I'm a Windows user and still new
to linux stuff, so if it sucks or could be simplified just let me
know.

And as a secondary question, just curious what people think about
rebasing onto a remote tracking branch. When I do merges I usually
refer to the remote branch, but during rebase I use the local branch
instead, but I don't know if there is any functional reason to not
skip the local branch and go straight to the remote tracking branch
(it saves a step).

             reply	other threads:[~2014-02-12 21:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12 21:55 Robert Dailey [this message]
2014-02-13  8:42 ` Process of updating a local branch from another with tracking Chris Packham

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=CAHd499CQK7Mmd+vWb74Nj4usX8KhmurJNd31MrAMUs6Vb2zOOw@mail.gmail.com \
    --to=rcdailey.lists@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).