Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by yjftsjthsd-h on Saturday February 19, 2022 @01:35PM
(#30399316)
If you can rewrite the history that actually got committed, do you really need a temporary pre-commit staging area?
[ Parent
| on HN ]
Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by bonzini on Saturday February 19, 2022 @01:41PM
(#30399360)
The index is mostly useful to me to split a commit in multiple ones. You do that with a sequence of "git add -p" and "git commit" commands. I am interested in how to do this with jj, because otherwise it looks like a very interesting tool.
Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by martinvonz on Saturday February 19, 2022 @01:54PM
(#30399476)
> I am interested in how to do this with jj
`jj split -r <commit>`, where `<commit>` may be the working copy commit (which is the default). See https://github.com/martinvonz/jj/blob/main/docs/git-comparis... for more examples.
Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by detaro on Saturday February 19, 2022 @02:21PM
(#30399698)
so just for understanding: repeated `git add -p` followed by a `git commit` turns into repeated `jj split; jj squash`, since you create a commit each time?
Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by martinvonz on Saturday February 19, 2022 @02:29PM
(#30399754)
That would work, yes, but there's also `jj squash -i` to move part of the child commit into the parent. There's also the more generic `jj move` command for moving part of any commit into any other commit (ancestor, descendant, sibling), so you `jj squash -i` is equivalent to `jj move -i --from @ --to @-` (where `@` is syntax for the working copy commit and `@-` is syntax for its parents).
Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by erik_seaberg on Saturday February 19, 2022 @03:46PM
(#30400382)
I prefer "git stash -p" to exclude unfinished changes, because if I build up a partial commit in the index there’s no way to test it.
Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by cryptonector on Saturday February 19, 2022 @03:58PM
(#30400472)
I do that later. I do `git rebase -i` and add `exec` lines to build each commit that must build.
Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by masklinn on Saturday February 19, 2022 @01:53PM
(#30399466)
> You do that with a sequence of "git add -p" and "git commit" commands.
You can do that with git commit -p.
Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by bonzini on Saturday February 19, 2022 @02:34PM
(#30399789)
True but there's usually a "git diff --staged" in the middle to check what I am committing.
Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by masklinn on Sunday February 20, 2022 @02:19AM
(#30403886)
You can do that with “git show HEAD” (and “git commit --amend -p”).
Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by cryptonector on Sunday February 20, 2022 @11:34PM
(#30412011)
`git diff --staged` is superior. For one, you get all the options to `git diff`. For another, it has no side effects, unlike `git commit --amend -p`.
Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by masklinn on Monday February 21, 2022 @03:46AM
(#30413362)
> `git diff --staged` is superior. For one, you get all the options to `git diff`.
Most of which you can get on git show at least if they're relevant to “what have I added”. And of course you can also use git diff on commits if you need something super specific.
> For another, it has no side effects, unlike `git commit --amend -p`.
… “git commit --amend -p” is the replacement for subsequent “git add -p”, as the GP was talking about a workfliw where they’d intersperse staging stuff and looking at what they’d staged.
Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by cryptonector on Saturday February 19, 2022 @03:58PM
(#30400477)
Exactly!
Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by cryptonector on Saturday February 19, 2022 @03:57PM
(#30400469)
`git add -e` is infinitely better.
Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by andrewshadura on Saturday February 19, 2022 @05:45PM
(#30401240)
Try git-crecord.
Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by cryptonector on Saturday February 19, 2022 @03:56PM
(#30400466)
Yes, I do. I often do this (usually in detached HEAD mode!):
: ; $EDITOR some-file ...
: ; $build
: ; git add -e # take a few chunks, maybe change them
: ; git diff --staged; git status -uno
: ; # lather, rinse, repeat
: ; git commit -m '...' -ev
: ;
: ; git status -uno; git diff
: ; git add -e # ..
: ; # lather, rinse, repeat until happy
: ;
: ; git fetch origin
: ; git rebase origin/master
: ; # fix any conflicts
: ;
: ; # continue until all bug fix / feature
: ; # activity for this issue is complete
: ;
: ; # review my changes:
: ; git log --patch origin/master..
: ;
: ; # if I have to clean my history a bit:
: ; git rebase -i origin/master
: ; # re-order commits, `edit` commits, `drop`
: ; # commits as needed
: ; $build
: ; # fix remaining issues...
: ;
: ; # finally ready to push:
: ; git push myclone HEAD:refs/heads/this-thing
: ;
: ; # open a PR
Repeat as needed to deal with code review comments until done and integrated.
Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by c-smile on Saturday February 19, 2022 @04:47PM
(#30400844)
Are you human?
> detached HEAD mode
Ah, I see, not anymore...
Re:Jujutsu – A Git-compatible DVCS that is both simple and p...
by cryptonector on Sunday February 20, 2022 @01:55AM
(#30403785)
Lol, have an upvote!