git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Mahesh Vaidya <forvaidya@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: How to Push a range of commits.
Date: Wed, 30 Jun 2010 15:47:58 +0200	[thread overview]
Message-ID: <20100630134758.GC30999@debian> (raw)
In-Reply-To: <AANLkTikOffJHjzd3iBOXm7Lt7uPzHGkR1kfWtxSd-F9S@mail.gmail.com>

Hi Mahesh,

Mahesh Vaidya writes:
> On branch 'foobar' I have a range of contiguous  commits  say C1...C9,
> C1 being at HEAD / TOP.
> 
> If I push branch all 9 commits will make it to authoritative
> repository.  Is there a way to push a single commit (as C9 or C10 new
> commit) which is common change set between C1 .. C9

Do you want to squash all the commits into one commit and push that?
If so, use the interactive rebase to squash them into one commit (in
possibly another branch) and push that commit.

If you want to push just a few commits instead, create a new branch
based on upstream, cherry-pick the commits you want into it and push
it to the upstream branch. For example, if I have a branch `foo`
tracking the upstream `origin/foo` and is ahead of the upstream by 10
commits, but I only want to push commit `bar`:

$ # In branch foo
$ git checkout moo # New temporary branch
$ git reset --hard origin/foo # Base it on upstream
$ git cherry-pick bar
$ git push origin +refs/heads/moo:refs/heads/foo
$ # I think the "refs/heads" part can be omitted in the above command

-- Ram

      reply	other threads:[~2010-06-30 13:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-30  5:51 How to Push a range of commits Mahesh Vaidya
2010-06-30 13:47 ` Ramkumar Ramachandra [this message]

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=20100630134758.GC30999@debian \
    --to=artagnon@gmail.com \
    --cc=forvaidya@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).