threads / discuss / 25104

Import existing (old) topic branches in topgit

Subject: Import existing (old) topic branches in topgit

## tl;dr

2 messages between Sep 14, 2010 and Sep 15, 2010.

replies: 1people: 2as markdown or json

Guilhem Bonnefille· Sep 14, 2010, 20:44 UTC · lore
Hi all,

After trying to manually maintain many topic branches before sending them upstream, I recently discovered that topgit seems to become my best friend.

But as I'm new to this tool, I don't know what's the best way to import existing branches in topgit.

What I mean is:
* I already have topic branches, with long history and regular merges
with upstream.
* I want to manage the related topic via topgit
* I whish to keep my own history (if possible)
Can experimented users give me some tips on how to do this?
Thanks in advance.
-- 
Guilhem BONNEFILLE
-=- JID: guyou@im.apinc.org MSN: guilhem_bonnefille@hotmail.com
-=- mailto:guilhem.bonnefille@gmail.com
-=- http://nathguil.free.fr/
martin f krafft· Sep 15, 2010, 04:55 UTC · re: Guilhem Bonnefille · lore

Re: Import existing (old) topic branches in topgit

also sprach Guilhem Bonnefille <guilhem.bonnefille@gmail.com> [2010.09.14.2244 +0200]:
> But as I'm new to this tool, I don't know what's the best way to
> import existing branches in topgit.

There is tg-import, but it looks like it rewrites the history, which you might not want.

This should be trivially possible, and it would be nice if TopGit could help you, but for now you will have to do this manually. The following is an example for the simple case when branch foo depends on master, and you want to convert foo:

1. git checkout foo    # the topic branch
2. git update-ref refs/top-bases/foo $(git merge-base master HEAD)
3. echo master > .topdeps
4. git format-patch --stdout -s HEAD^ | sed -e 1d -e '/---/,$d' -e '/^Date:/d' > .topmsg
5. git add .top(deps|msg)
6. git commit -sm'convrting branch to topgit format'
7. tg summary
Now: will you write a new tg-import or tg-convert? ;)
Cheers,
-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
a: no.
q: should i include quotations after my reply?
 
spamtraps: madduck.bogus@madduck.net

← back to recent threads