Hacker News new | ask | show | jobs
by sreevisakh 1853 days ago
Interesting! Is that workflow similar to what Quilt [1] or Stacked Git [2] is used for? And how do you achieve that now?

[1] https://savannah.nongnu.org/projects/quilt [2] https://stacked-git.github.io/

1 comments

Those look interesting. If I understand them right they've for mailinglist-based dev where you email patches around?

I prefer a model where you use a forge for collaboration, and don't rewrite shared history. However, you use rebase extensively locally.

Right now I use magit with fixup. It's just more keystrokes. I want to be able to highlight a change to the workdir, hit a key and select a local commit (right now it's highlight, hit the fixup shortcut, select the commit, open a rebase at the appropriate early commit, complete the rebase). I also want to be able to partially stage a newly created file (right now it's cut and paste part of it into a temp file)

I just discovered today that intellij has the concept of named changesets (i.e multiple staging areas, and you select 1+ to commit). I like it, but I don't think you can check them out and they don't work with external git commands. My temp commits would just be regular commits prefixes with "wip: "

> If I understand them right they've for mailinglist-based dev where you email patches around?

You're right, but I think they are not limited to it. Stgit has a command to directly convert patches to commits. Quilt deals only with patches. So the patches will have to be applied to working tree before they can be committed.

> I want to be able to highlight a change to the workdir, hit a key and select a local commit

> I just discovered today that intellij has the concept of named changesets (i.e multiple staging areas, and you select 1+ to commit).

I am still learning stgit, but I think this is what stacked patches essentially achieve. The patches can effectively be used as multiple staging areas. You can design multiple commits simultaneously and commit them independently. Here is my novice assessment of that workflow: https://gitlab.com/-/snippets/2126398

> I also want to be able to partially stage a newly created file (right now it's cut and paste part of it into a temp file)

That sounds like interactive staging (`git add -p` or `git add -i`). You can do the same in magit, in the status window by selecting the diff lines you want to stage. I use evil-mode and use visual mode for that selection. Am I missing something about your requirement?

> That sounds like interactive staging (`git add -p` or `git add -i`). You can do the same in magit, in the status window by selecting the diff lines you want to stage. I use evil-mode and use visual mode for that selection. Am I missing something about your requirement?

At least in magit, you get the error "new file ... depends on old contents" if you try to stage a hunk of a newly created file.

(i.e. echo "foo\nbar" > file, then stage only "bar")