Live data from Hacker News

Show HN: Tool to Automatically Create Organized Commits for PRs

github.com

51–54 of 54 posts

Re: Show HN: Tool to Automatically Create Organized Commits for PRs

#51
post #47
post #45

Earlier quoted context omitted.

You can do it to any change in the repo and everything gets automatically rebased downstream of it - so if you three nicely structured changes you can go change the first one if you need and it just works. I’m selling it short a bit - it does a lot more! There’s a great Steve Klabnik tutorial [1]. To me the main thing is it makes it very easy to think and work in terms of logical changes. [1] https://steveklabnik.git…

> You can do it to any change in the repo and everything gets automatically rebased downstream of it So does `git rebase -i $commit^1` and marking the commit with `edit`, any commit afterwards (which I think you mean by "downstream"?) also gets rewritten since you've changed a commit in the middle. I'm not sure if you're selling it a bit short, or if `jj` just have a target audience that I am not a part of, both are…

Yes, the result is (almost) just regular Git commits, so there isn't anything jj can do that Git cannot do. It's just often a lot easier to do it with jj.

A lot of jj users are former Git power users. If all you do you use is `git clone`, `git commit -A`, `git push`, `git pull`, then there's much less to gain for you from switching.

Since you seem to know how to use interactive rebase, I think you are the target audience.

To clarify what's easier in the scenario mentioned above:

1. You don't need to check out a specific branch to start the interactive rebase from. You simply check out the commit you want to edit and then squash into.

2. You don't have to manually rebase other descendant branches. (I.e. if the commit you're modifying is in multiple branches.)

3. Branches (jj calls them bookmarks) get automatically updated. I know Git now has `--update-refs`, but you never need pass that with jj (maybe Git has a config for it, I haven't checked).

4. If you had a dirty working copy before you decided to fix up this commit, you won't need to manually stash or commit those changes.

5. If editing the commit results in conflicts in some descendant, you don't have to resolve those right away.

Try it and let us know how it goes?

Re: Show HN: Tool to Automatically Create Organized Commits for PRs

#52

Earlier quoted context omitted.

I have yet to see anything in jj that isn't also a git operation, they're just emphasized and exposed differently, and the gg GUI makes some things more intuitive (and also makes screwing up your history accidentally much easier).

In some sense, every jj command does more than any single git command because they implicitly amend the working-copy commit and rebase any descendants on top. Another example is `jj rebase -d main`. It may look very similar to `git rebase main`, but it rebases a whole tree. See https://stackoverflow.com/questions/17315285/rebasing-a-tree... if you don't know what I mean. Another example is `jj squash --from main..my-…

Oh I'm not saying jj commands are 1:1 to git. But it looks very much like a convenience layer on git, which is supported by the fact that it (can?) use(s) git as its storage backend. So people are essentially commenting "that jj thing looks perfectly doable in plain git too".

Re: Show HN: Tool to Automatically Create Organized Commits for PRs

#53

Earlier quoted context omitted.

In some sense, every jj command does more than any single git command because they implicitly amend the working-copy commit and rebase any descendants on top. Another example is `jj rebase -d main`. It may look very similar to `git rebase main`, but it rebases a whole tree. See https://stackoverflow.com/questions/17315285/rebasing-a-tree... if you don't know what I mean. Another example is `jj squash --from main..my-…

Oh I'm not saying jj commands are 1:1 to git. But it looks very much like a convenience layer on git, which is supported by the fact that it (can?) use(s) git as its storage backend. So people are essentially commenting "that jj thing looks perfectly doable in plain git too".

Yes, that's correct. It's also correct to say that you don't "need" the Git porcelain commands because it's perfectly doable using Git plumbing :)

Re: Show HN: Tool to Automatically Create Organized Commits for PRs

#54
post #20

I didn't look at things too closely, but it would be nice if this each commit would include a ticket number from the branch (such as a linear id) and/or pr id in each commit for people who do not squash. One huge advantage of squashing branches is if you see a commit in a `git blame` you might have an idea of where it came from within GitHub/Linear/other systems.

Surely this would be the job of a prepare-commit-msg/commit-msg hook?

Built this: https://github.com/jaredsohn/git-linear-hook

You can also use the --instructions param for this tool to name commits via the LLM.

Post reply on HN