On Fri, Nov 27, 2026, at 00:44, Hamdan wrote:
> Hi all, > > I'd like to share an early idea and hear whether it makes sense for Git. > > The idea > > Most of the time, developers (and now AI coding agents) work in > discrete tasks: adding a payment gateway to an existing app, building a > versioned update system, and so on. While doing a task, we commit > periodically as we hit milestones, so the work stays saved and > traceable. > > Today, if you want those commits to read as one unit later, you usually > create a branch or worktree, commit there, then bring it back into main > with a rebase, a merge, or a pull request. In a commit graph it looks > like this: the branch splits off at commit 187, runs through to 247, > and merges back into main at 248. > > What I'm proposing is a native Task primitive that gives you the > grouping without the branching: > > git task start "add payment gateway" > git commit ... > git commit ... > git task done > > A task is a box around a unit of work. You can stay on main the whole > time. When you look at history later, commits 187 to 247 show up as one > task that you can collapse or expand, like a collapsible list, so it's > clear what was built there.
You should write what you want to achieve first and then how it works. • “You can stay on main”—so it’s like a branch, but different? • “that you can collapse and expand”—you can collapse and expand (sort of) the history according to merges, `--first-parent`, and so on What I often see is that people want this: • Person A: I would like a sort of subcommit: it’s less important than a mainline (`--first-parent`) commit. You can hide it if you want. Or show it. • Person B: Oh, but you can use merges for that • (The most “diligent” approach is to rebase the branch against upstream before the non-fast forward merge, so the first parent of the merge commit is the same parent as the first commit “on the branch”. This approach is an alternative to having all commits on mainline without any merge commits. It won’t work for workflows where you might fix an old bug on top of the buggy commit and then merge it into five release branches.) The conversation ends there if person A is fine with merges. But some are not, for some reason. They still want to make all commits on mainline while being able to expand and collapse them.
> > Why it matters > > - Readability: on large codebases, history reads as a list of tasks > instead of a flat stream of commits.
Many projects use pull requests where a merge on mainline means one finished task.
> > - Lower friction: for beginners, small tasks, small teams, and > early-stage startups, "start a task, commit, finish the task" is > simpler than creating branches, switching context, rebasing, merging, > and managing merge commits or PR overhead.
I notice that for tasks here you just start a task, do the work, then finish. But for branches you start them, do the work, *switch contexts*, *rebase*, ... you’re comparing a clean and perfect execution for tasks with an imperfect, interrupted, and time-worn (rebase) approach with branches.
> > - Agents: an AI agent can open a task, checkpoint freely inside it,
Like with branches.
> and the whole task can be reviewed or reverted as one unit.
Reviewed yeah. You can also “revert” a branch by reverting a merge. Although, I feel that reverting a merge is more advanced and has more caveats than reverting a single commit. But I am skeptical when people say that reverting whole tasks is important. Having to revert entire tasks suggests code churn, and frequent reverts lead to more maintenance burden. A revert is just a reversed diff, so the extra code change leads to the same issues with potential merge conflicts when multiple people are working together.
> > Single-branch and multi-branch tasks > > A task doesn't have to be tied to one branch. It can live: > > - on a single branch, e.g. a feature built directly on main, even if > unrelated commits land in between;
Next you propose using trailers to implement this. As such a task cannot be tied to a branch since a branch is a ref. So that’s fine.
> > - across several branches, e.g. a fix on main that is also > cherry-picked to two release branches, or a feature with a backend part > and a frontend part on different branches. Four commits on four > branches, one task.
Oh, here’s something that makes me glad that git(1) has not supported some kind of persisted ID for commits beyond `git cherry-pick -x`;[1] it makes it *less tempting* to use cherry picks and whatnot to effectively duplicate commits for releases. Cherry picks are the copy–paste of Git. The commit graph is first-class and you can easily query for one commit being present in however many branches. Cherry picks (or equivalent) are just duplicated changesets: more costly to query for, you have to make sure to mark the origin, and they clutter the history when you go spelunking later (you might hit some commit that you were looking for, but it turns out that it’s the cherry pick on some release branch that you didn’t care about.[2]) Making it easier to duplicate changesets is not a good thing. † 1: A patch ID can identify a change, but I’m talking about marking the commit itself with it. † 2: I imagine. Haven’t done much of that in anger.
> > To support both, a task would be identified by an ID stored in each > commit (a trailer such as "Task: payment-gateway"), not by a commit > range. That ID survives rebase and cherry-pick, so Git could answer > "which commits belong to this task?" and "which branches has it landed > on?"
The implementation is fine and aligns well with people’s apparent love for issue managers. I mean, so many people put issue keys in the commit message. They might as well put it in a `Task` trailer. Note: that `payment-gateway` task might come up again as the same string in two years time. Issue keys often work better in practice if you want a unique key since they use some prefix with an incrementing number.
> > What this isn't > > This doesn't replace branches. Branches give isolation: your unfinished > work doesn't affect anyone until you merge it. Tasks only give > grouping. Larger teams that need review before code lands would still > use branches and PRs, and tasks could work alongside them.
LLM waffling but okay. The branch “grouping” is implicit, so I can see how the task grouping is different (explicit).
> > I know related things exist: --no-ff merges read back with > --first-parent, commit trailers, GitButler's virtual branches, and > Jujutsu's change IDs. My feeling is that none of them make "this is one > task" a simple, first-class concept.
Again, you have to work more on the motivation. There’s a lot of text here on agents, multi-branch setups, small teams, early stage startups—a lot of talk about how it fits in with everything before it has been established how useful it is. Most people are in fact fine with most things being second class. Motivating raising it to being first class can be a tall order.
> > This is an early concept, and I'm not sure it beats branches in every > case,
But two paragraphs ago you said that it wasn’t supposed to beat (replace) branches.
> but I think keeping the mental model this simple is worth > exploring. I'm happy to build a prototype first if that's the preferred > path.