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

Re: [PATCH 00/23] RFC: Introducing git-test, git-atomic, git-base and git-work

From
Jon Seymour <jon.seymour@gmail.com>
Date
Apr 23, 2011, 17:16 UTC
Message-ID
<BANLkTinhjMtNc257NnOCZe6askr2i=4g6Q@mail.gmail.com>
In-Reply-To
<20110423091300.GC9206@m62s10.vlinux.de>
On Saturday, April 23, 2011, Peter Baumann <waste.manager@gmx.de> wrote:
Show 50 quoted lines
> On Sat, Apr 23, 2011 at 05:22:29PM +1000, Jon Seymour
>   git checkout master
>   git merge debug topic1 topic2 topic3
>   ... compile ... deploy ... test
>
>                . -  q - q -.       <- topic3
>               /             \
>            . -s - s - s ---. \     <- topic2
>           /                 \|
>          /    t - t - t - - -\     <- topic1
>         /   /                 m    <- master
>        /   /                / |
>    o - o - o - o - o - o - o  |    <- remotes/trunk
>                 \            /
>                   d  - d - -       <- debug
>
> Having fond a small error, I can't commit it directly on the merge m, because
> It is actually a fix a topic branch. Running git checkout topicX before doing
> any change is also not an option, because I often forget to checkout the topic
> before commiting. And rebasing afterwards is also not that easy, because there
> is merge m in between.  So this isn't what I actually use, but would be *iff*
> there where some sort of tool support to help me.
>
> What I end up doing is the following:
>
> - o - o   <- remotes/trunk
>        \
>          d - d   <- debug
>               \
>                 t - t -t  <- topic1
>                         \
>                           s - s -s  <- topic2
>                                   \
>                                    q - q   <- topic3, master
>
>
> The topic branches are just there for illustration, I normally do not track
> those explicitly with git branches, as master is rebase often on top of trunk,
> thanks to git-svn. Now if I do want to commit a topic branch to SVN, I rebase
> so that my history is now   trunk - topic1 - debug - topic2 - topic3, master
> and then run git checkout topic1; git svn dcommit to make sure only the commits
> in topic1 are commited.
>
> All in all, this workflow is not perfect, but at least it sort of works.
>
> Now back to my initial question:
> Could your new "git work" command help me to adjust my workflow and ease the pain?
>
> > Peter
>
Hi Peter,
Yes, git work is good for this use case.
You would tend to manage you master branch as in your first diagram above.

Suppose you found a problem on topicX. So, you fix the issue inplace on the top of your master that includes all 5 dependencies. Call this commit m'.

You have decided that the fix really belongs on topic2. So what you do is:
git work update topic2 HEAD~1

This will move that commit onto the tip of topic2 (producing topic2'), merge that into m (producing m''), and reset master to m''.

One thing to note is that you never share master. It will be a merge hell. You only ever share topics when they become stable.

As the trunk gets updated you do:
git work merge remotes/trunk

It will merge remotes/trunk into the base of your unpublished work, then rebase your unpublished work onto that merge.

git work is also excellent for keeping your debug branch available in your working tree but isolated from your topics.

Things get little tricker when you have a commit that spans multiple topics. However, there is a straight forward methodology for managing such issues. There are also techniques for dealing with conflicts with any dependency, especially remotes/trunk which I can explain in another note if there is interest.

Jon.
Previous: Peter BaumannNext: Jon Seymour
Message 27 of 29 in “RFC: Introducing git-test, git-atomic, git-base and git-work”
  1. 00/23 RFC: Introducing git-test, git-atomic, git-base and git-workJon Seymour, Apr 23, 2011
  2. 01/23 Introduce git-test.sh and git-test-lib.shJon Seymour, Apr 23, 2011
  3. Drew NorthupApr 27, 2011
  4. 02/23 Introduce --unstaged.Jon Seymour, Apr 23, 2011
  5. 03/23 Introduce --stagedJon Seymour, Apr 23, 2011
  6. 04/23 Introduce --untracked.Jon Seymour, Apr 23, 2011
  7. 05/23 Introduce --conflictedJon Seymour, Apr 23, 2011
  8. 06/23 Introduce --rebasingJon Seymour, Apr 23, 2011
  9. 07/23 Introduce --detachedJon Seymour, Apr 23, 2011
  10. 08/23 Introduce --branch-existsJon Seymour, Apr 23, 2011
  11. 09/23 Introduce --tag-existsJon Seymour, Apr 23, 2011
  12. 10/23 Introduce --ref-existsJon Seymour, Apr 23, 2011
  13. 11/23 Introduce --commit-exists.Jon Seymour, Apr 23, 2011
  14. 12/23 Introduce --checked-outJon Seymour, Apr 23, 2011
  15. 13/23 Introduce --reachableJon Seymour, Apr 23, 2011
  16. 14/23 Introduce --tree-same.Jon Seymour, Apr 23, 2011
  17. 15/23 Introduce --sameJon Seymour, Apr 23, 2011
  18. 16/23 miscJon Seymour, Apr 23, 2011
  19. 17/23 whitespace fix.Jon Seymour, Apr 23, 2011
  20. 18/23 tests --conflicted.Jon Seymour, Apr 23, 2011
  21. 19/23 rebasing: add testsJon Seymour, Apr 23, 2011
  22. 20/23 test: git test cleanups.Jon Seymour, Apr 23, 2011
  23. 21/23 Introduce git-atomic.Jon Seymour, Apr 23, 2011
  24. 22/23 Introduce git base.Jon Seymour, Apr 23, 2011
  25. 23/23 Introduce support for the git-work command.Jon Seymour, Apr 23, 2011
  26. Peter BaumannApr 23, 2011
  27. Jon SeymourApr 23, 2011
  28. Jon SeymourApr 23, 2011
  29. Jon SeymourApr 24, 2011

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.