git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to maintain private/secret/confidential branch.

From
Łukasz Lew <lukasz.lew@gmail.com>
Date
Dec 14, 2008, 16:48 UTC
Message-ID
<c55009e70812140848j79202b0aqc6ffbfecfff50757@mail.gmail.com>
In-Reply-To
<20081214160645.GA21358@myhost>
Hi Alexander,
On Sun, Dec 14, 2008 at 17:06, Alexander Potashev <aspotashev@gmail.com> wrote:
Show 34 quoted lines
> Hello, Łukasz!
>
> On 16:38 Sun 14 Dec     , Łukasz Lew wrote:
>> Thanks Nick, thats really helpful (and surprisingly simple).
>> I have a couple more questions:
>>
>> On Sun, Dec 14, 2008 at 15:55, Nick Andrew <nick@nick-andrew.net> wrote:
>> > On Sun, Dec 14, 2008 at 02:49:50PM +0100, Łukasz Lew wrote:
>> >> I don't know how to make such a scenario work:
>> >> - two repositories: pub, priv
>> >> - priv is clone/branch of pub
>> >> - there is some constant developement both in pub and priv
>> >> - there are regular syncs with pub in priv
>> >>
>> >> Problem:
>> >> Occasionally I want to push some changes from priv to pub.
>> >> Then after syncing with pub I want to get as few conflicts as possible.
>> >>
>> >> Is it possible to do with git?
>> >
>> > Git can do almost anything. One should instead ask "How to do this
>> > with git?" :-)
>>
>> So I've heard, but not yet experienced it myself. I'm thrilled to try.
>>
>> >
>> > 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?
> It's, however, better to make more commits to not experience the need of
> commit splitting.

Indeed good advice and best practice, but another best practice is to not commit not compiling state. My common scenario is that I code a big change in priv repository, and after that I find that some of its parts can and should be moved to pub.

Show 9 quoted lines
>
> But you can use '--no-commit' option of 'git cherry-pick' and 'git merge'
> (and 'git pull' as well as 'git merge'). For example:
>
>        git cherry-pick --no-commit <sha1>    # cherry-pick without commiting
>        git reset --                          # unstage all changes
>        git add -p                            # patch update
>
> You can also use 'git add -i' (interative mode) instead of 'git add -p'.

That's a possible solution indeed. Now I see that the right "plumbing" I need is splitting a commit into smaller parts and merging several commits into a larger one.

I think that would be nice functionality.

Do you know any tool that would allow such a manipulation on commits in history?

Thanks Lukasz

Show 20 quoted lines
>
>>
>> > Push your for-public branch to pub,
>> > then rebase your private branch.
>>
>> Rebase to the tip of master? Is it needed? Ie. cherry-pick does not
>> remove the patch from
>> the master in priv.
>>
>> If I now pull from pub, I will get the same change and it mereges nicely :D
>>
>> Can I get away without creating for_pub branch? maybe cherry pick in
>> pub from priv somehow?
>>
>> >
>> > Nick.
>> >
>
>                                        Alexander
>
Previous: Alexander PotashevNext: Daniel Barkalow
Message 5 of 11 in “How to maintain private/secret/confidential branch.”
  1. Łukasz LewDec 14, 2008
  2. Nick AndrewDec 14, 2008
  3. Łukasz LewDec 14, 2008
  4. Alexander PotashevDec 14, 2008
  5. Łukasz LewDec 14, 2008
  6. Daniel BarkalowDec 15, 2008
  7. Łukasz LewDec 17, 2008
  8. Daniel BarkalowDec 17, 2008
  9. Łukasz LewDec 17, 2008
  10. Daniel BarkalowDec 18, 2008
  11. Sitaram ChamartyDec 14, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.