From: Sitaram Chamarty <sitaramc@gmail.com>
To: git@vger.kernel.org
Subject: Re: How to maintain private/secret/confidential branch.
Date: Sun, 14 Dec 2008 16:13:13 +0000 (UTC) [thread overview]
Message-ID: <gi3bap$asc$1@ger.gmane.org> (raw)
In-Reply-To: c55009e70812140738l8b51adax77cc6e507971554e@mail.gmail.com
On 2008-12-14, Łukasz Lew <lukasz.lew@gmail.com> wrote:
> On Sun, Dec 14, 2008 at 15:55, Nick Andrew <nick@nick-andrew.net> wrote:
>> If I understand your problem, you could solve it with git cherry-pick
>> and rebase. On priv, make a for-public branch from a pub branch. Then
>> cherry-pick the commits you want from your private branch into the
>> for-public branch.
>
> That almost works. Can I somehow split existing commits
> just like in git-add -p?
This is going to sound weird to some seasoned folks, and I'm
hoping to hear better ways of doing this. But having done
stuff like this, I once wrote it up and here're my notes:
To split just the top commit into multiple commits:
* start git gui
* choose "amend last commit" from the commit menu
* unstage all files (meaning you click on the little
icons so they move from the left-bottom panel to the
left-top panel)
* pick files or hunks in files to stage and commit the
usual way
* continue all changes are committed
To split a commit that is *not* the top one:
* start an interactive rebase that includes that commit
* mark that commit as "edit" and start the rebase
* when the rebase pauses, use git gui as described above
To combine a set of commits and split the result in some
other way (meaning you have commits A B P Q C D R E S and you
want to make them A B C D X Y Z where X+Y+Z = P+Q+R+S!)
* start an interactive rebase
* move lines as appropriate (in the editor) so the
commits P,Q,R,S are together
* choose "squash" on the second and subsequent ones and
start the rebase
* (dirty trick warning) when the editor for the combined
commit message pops up, delete ALL the lines and save
* use git gui as above
* then continue the rebase
Hope this helps...
prev parent reply other threads:[~2008-12-14 16:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-14 13:49 How to maintain private/secret/confidential branch Łukasz Lew
2008-12-14 14:55 ` Nick Andrew
2008-12-14 15:38 ` Łukasz Lew
2008-12-14 16:06 ` Alexander Potashev
2008-12-14 16:48 ` Łukasz Lew
2008-12-15 20:31 ` Daniel Barkalow
2008-12-17 19:57 ` Łukasz Lew
2008-12-17 20:27 ` Daniel Barkalow
2008-12-17 22:31 ` Łukasz Lew
2008-12-18 8:03 ` Daniel Barkalow
2008-12-14 16:13 ` Sitaram Chamarty [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='gi3bap$asc$1@ger.gmane.org' \
--to=sitaramc@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).