Replies: 3 comments 6 replies
-
Jujutsu saves conflicts as special files (if you check out the commit with Git, you'll see a I had documentation of the format in the README a long time ago (before I started targeting users instead of developers in the documentation). You can read it here. I need to recover that information and put it in a more accessible place. This discussion between and me and @quark-zju may also help explain it. |
Beta Was this translation helpful? Give feedback.
-
Yes, you need to create refs pointing to the data the conflicts point to. You don't need to have references to the conflicts themselves, because they are pointed to directly by the tree objects they're in. You just need references to the objects involved in the conflict. I need to fix that in |
Beta Was this translation helpful? Give feedback.
-
This is visually presented to the user by showing a commit as the shared base
So far I've considered this "good enough" because its already streamlined so much of my workflow I don't mind the occasional hand done rebases. |
Beta Was this translation helpful? Give feedback.
-
It's clear that the workflows around resolving merge conflicts are clumsy in Git. What's the best way to fix this?
I think there are main fundamental issues that impede these workflows:
git undo
.For
git-branchless
to integrate well with Git, I think there are a few options.Don't merge
Don't resolve merge conflicts by default when carrying out operations. The user should have to opt-in via a
--merge
flag. Personally, I don't like how rebase operations sometimes rudely introduce merge conflict state that I then have to abort.In my opinion, this solution is probably worth doing regardless of whether we pick one of the below solutions as well.
Merge as much as possible
When updating local commit stacks to be based on the latest main branch, move the stack as far as possible along the main branch. This is an option available in https://github.com/Timmmm/autorebase (cc @Timmmm), and also mentioned in https://github.com/epage/git-stack/issues/25 (cc @epage).
In the above solution, we try to rebase the entire commit stack as much as possible. It would also make sense to rebase as much as of the commit stack as possible. So you would start with a graph like this:
And then, rather than forcing merge conflict resolution to happen immediately, we would end up with a graph like this:
It would definitely be good to know how much of the move operation succeeded, but I don't like the idea that I might accidentally fail to move an entire stack of commits when I intended to.
Mark conflicting commits in the smartlog
Like the above solution, but explicitly mark details of the conflict in the smartlog:
If you check out to
abc002
, then thepost-checkout
hook would do one of the following:git restack
, so that you can initiate merge conflict resolution.But then I'm not sure how we would dissociate the commit with its merge conflict. What if we want to move it somewhere else in the commit graph, or simply silence the warning in the smartlog?
Simulate commits with conflicts
If a merge conflict would occur as a result of an operation, pretend that the operation succeeded, but that the rebased commit is marked with a conflict. We would be simulating the behavior of Jujutsu as much as possible within the Git design. So you would start with a graph like this:
Then after trying to rebase the stack and encountering a conflict in
abc002
, the smartlog would look like this:Note that the commit hash
abc002
remains unchanged. This rendering above is only for the smartlog.This is paradigm-shifting, and introduces a compelling alternative to the current solution. The problem I have with the design is that I often want to use the pre-conflicted version (for example, to test to see if a certain test fails before versus after rebasing on top of the main branch). It's not clear how to do this under the Jujutsu model (@martinvonz do you have a solution for this workflow?).
And this is a leaky abstraction when implemented on top of Git. If usability is a goal for
git-branchless
, is it worth creating commands with a brand new set of difficult-to-inspect state? We might be able to preserve the abstraction within the universe ofgit-branchless
commands, but what if someone runsgit checkout abc002~
? Would we conceptually like to put them atabc001
orabc004
, and does that fall in line with user expectations?One solution to fixing the abstraction a little is to actually carry out the rebase by keeping conflict markers in the conflicting files and committing that. Then, the contents of commit are sensible if you try to operate on it; we just have to be sure to precisely track that the commit is associated with a previous patch which needs to be merged properly. (It also gets complicated for descendant commits, which may or may not conflict with the first conflicting commit, depending on its actual resolution. I think Jujutsu has a principled solution for this, but I don't know what it is.)
It might also be possible to use some kind of synthetic commit identifier to make sure that the user can't accidentally mix up conflicted commits with real commits. If the commit identifier is instead
ghijkl
, then surely the user won't use it in Git commands inappropriately. (And let's just hope thatghijkl
isn't the name of a branch...) Or we can use an arbitrary commit hash, and automatically tag it with a useful branch, likeconflict-1
, to make it easier for the user to address.Beta Was this translation helpful? Give feedback.
All reactions