News for hackers. Stuff that matters.
Re:Stacked Git – manage commits as a stack of patches by Hackbraten on Thursday May 27, 2021 @02:01PM (#27306097)
Why would I use Stacked Git rather than Git’s fixup/interactive rebase dance?

For example:

    git commit -m "one thing"
    # commit hash: deadbeef

    git commit -m "other thing"
    # commit hash: badf00d
(working on one thing) then:

    git commit --fixup deadbeef
(working on the other thing again) then:

    git commit --fixup badf00d
And in the end, when I’m ready to roll each patch into one commit, respectively:

    git rebase -i --autosquash

I do realize that Stacked Git allows me to switch between patches. Which is nice because regular Git wants me to type in SHAs for --fixup.

But I’m not sure I’d take on a new tool dependency just for that. What are other benefits of Stacked Git? Just wondering if I’m missing something.

Re:Stacked Git – manage commits as a stack of patches by lightgreen on Thursday May 27, 2021 @08:07PM (#27310199)
> Why would I use Stacked Git rather than Git’s fixup/interactive rebase dance?

Yeah, dance is good analogy. Lot of training, one little mistake and it is ruined.

For example, if you need to introduce a change in commit "one thing" which would require merge conflict resolving in "other thing", with stgit it would be much easier than with fixup/autosquash.

Or another example. You need to put away "other thing" for a while, and work with "one thing" for an hour, and then apply/fix "other thing". Another set of git tricks needed.

> But I’m not sure I’d take on a new tool dependency just for that.

If you are happy with git, nobody forces you to.

By the way, you don't have to use stgit all the time. I usually just use git, but when a change in a branch requires changing of previous commit, I simply do: stg init; stg uncommit; stg pop. It's easy to convert local repo state to and from stgit.

Re:Stacked Git – manage commits as a stack of patches by Hackbraten on Friday May 28, 2021 @03:54PM (#27319738)
Good points.
Re:Stacked Git – manage commits as a stack of patches by epage on Thursday May 27, 2021 @02:03PM (#27306117)
The main reason I've heard of people using tools like this is so people can review a commit at a time (a lot of review tools don't handle this well) and CI runs on each commit.

Generally, it sounds like people are simulated Phab with these tools which is trying to simulate the email patch workflow.

Re:Stacked Git – manage commits as a stack of patches by gorset on Thursday May 27, 2021 @02:31PM (#27306424)
We use gitlab and review a commit at a time and do CI runs on each commit in the MR branch. Just plain git with the fixup/interactive rebase dance. Gitlab is not optimized for this workflow, but it’s liveable.

Gitlab-runner can execute any shell commands, so it’s easy to just loop through all the commits and run bazel test.

Gitlab has improved lately and it’s now easier to review each commit in a MR, but you can sense that most of the PM attention is on the single commit/squash everything MR workflow.

Re:Stacked Git – manage commits as a stack of patches by Too on Friday May 28, 2021 @12:01AM (#27311600)
Parent example above doesn't change any of that. Don't be fooled by the squash in rebase -i --autosquash, there will still be a series of commits.
Re:Stacked Git – manage commits as a stack of patches by jpgrayson on Thursday May 27, 2021 @02:18PM (#27306282)
With the kind of git workflow you describe, bringing StGit into your tooling/workflow may not be worthwhile.

I'd say if you wanted to do these kinds of stack manipulations a little bit faster or with a little less cognitive overhead (e.g. named patches vs SHA1 hashes), then investing in StGit might pay off.

I generally would agree that using StGit isn't going to be a slam-dunk win for someone who already has a capable workflow using interactive git rebase.

Re:Stacked Git – manage commits as a stack of patches by juped on Thursday May 27, 2021 @04:07PM (#27307642)
Can you explain what your tool does to someone who knows what an interactive rebase is? I don't get much more from your blurb than "we reimplemented interactive rebase for some reason", but I'm sure you do something different or unique...
Re:Stacked Git – manage commits as a stack of patches by Hackbraten on Thursday May 27, 2021 @03:58PM (#27307487)
Got it. Thank you for clarifying.
Re:Stacked Git – manage commits as a stack of patches by juped on Thursday May 27, 2021 @04:06PM (#27307620)
if the commit name is more readily at hand, just name the commit "fixup! whatever". --fixup just does this for you since references are shorter and easier to type (it doesn't have to be a hash, it can be --fixup HEAD~2 or something).
Re:Stacked Git – manage commits as a stack of patches by urxvtcd on Friday May 28, 2021 @04:22AM (#27312977)
You can also use part of commit message to find that commit, so if you want to fixup "Refactor foo", you can run

    git commit --fixup :/foo
Re:Stacked Git – manage commits as a stack of patches by Hackbraten on Friday May 28, 2021 @10:52AM (#27316031)
Nice!