Git and Jujutsu: In Miniature
The article compares Git and Jujutsu in managing legacy code changes, highlighting Jujutsu's simplicity and efficiency in handling commits and tests, reducing cognitive load compared to Git's complexity.
Read original articleThe article discusses a scenario in software development where a developer uses both Git and Jujutsu (jj) to manage changes in a legacy codebase. The developer is working on a branch to replace an old parser with a new one and encounters a situation where a method directly calls the old parser, necessitating the creation of a new test. The process involves stashing changes, switching branches, and rebasing commits to ensure the new test is integrated correctly without disrupting the ongoing work. The author contrasts the complexity of Git's commands and decision-making requirements with the more straightforward approach of Jujutsu, which allows for easier manipulation of commits without the need for extensive context-switching or naming branches. The article highlights the efficiency of Jujutsu in managing version control tasks compared to Git, emphasizing the simplicity of inserting commits directly where needed.
- The article compares the use of Git and Jujutsu in managing changes in a legacy codebase.
- It illustrates a scenario where a developer needs to create a test for a new parser while working on an existing branch.
- Jujutsu simplifies the process of managing commits and changes compared to Git's more complex command structure.
- The author notes the cognitive load associated with Git's decision-making requirements.
- Jujutsu allows for easier integration of changes without the need for extensive context-switching.
Related
A Better Merge Workflow with Jujutsu
A new merge workflow using Jujutsu, a modern VCS compatible with Git, introduces The Austin™ Mega Merge Strategy®. It simplifies merge commits, amending commits, and selecting commits efficiently, enhancing collaboration and code review processes with advanced commit graph manipulation.
Jujutsu: A Next Generation Replacement for Git
Jujutsu, an experimental version control system by Martin von Zweigbergk, offers Git compatibility, simplified commits, effective conflict handling, and features like automatic rebasing. Despite being in active development with some limitations, it shows promise for revolutionizing version control.
How I Use Git Worktrees
The author advocates for using Git worktrees to manage multiple coding tasks concurrently, highlighting their benefits over branches for context switching and productivity in software development.
Steve Klabnik's Tutorial on Jujutsu (Git replacement)
Steve's Jujutsu Tutorial is a beginner-friendly guide on the Jujutsu version control system, covering installation, commands, workflows, and advanced topics, while encouraging community engagement and feedback.
Jujutsu (jj), a Git compatible VCS
Jujutsu (jj) is a new Git-compatible version control system that simplifies workflows with a user-friendly interface, focusing on changesets. It is still under development, with some features lacking.
I am hearing this argument a lot, but I don't really get it. My grocery store forces me to make a lot of decision when it offers me 7 kinds of ketchup and 20+ kinds of cereal, but no one says "I am avoiding large grocery stores because they force me to make too many decisions". If you are feeling adventurous, try something new. If you just want to get some food and go, grab your favorite brands. And yes, a smaller store won't force you to choose, but there is good chance you won't like the food you buy there.
(For the problem described, I'd do as following: Save WIP work as temporary commit. No, you don't want to juggle stashes. You can do interactive rebase with "edit" mode and then cherry-pick extra commit - this'll let you make sure test passes after rebase too. Yes, you need to come up with branch name, any will go, like c_s_test. You will need to keep the name of previous branch in your head, but given author uses "develop" it should not be too bad. But this is all my preferences, if someone wants to do something else - more power to them.)
I think it's better -- in the most pessimistic case -- to look at jj as reframing how you think about branches and commits in the same way that learning a type of Lisp reframes your thinking even if you're a full time Python developer and have zero intention of ever using a Lisp.
The idea of shuffling commits around without fear, changing your working train of thought mid-branch, etc. is natural... mindless, even. It's one command away and you get so much muscle memory executing that command you just do it automatically. (There's no fear because `jj undo` undoes any operation you did if you regret it. Of course there a ways to undo N operations back and so on too).
I use jj full time now, but even when I periodically go back to using git (for older projects I don't have a jj clone out for), it has altered the way I look at my stream of work. I think there's value in that.
That's the pessimistic case. The optimistic case is you should be using jj because it's better and there's almost zero downside to doing it (your coworkers don't even need to know).
(This blog post was great, I just expect and already see some people focusing on the minutia of how to Git golf your way to achieving the same thing easily when that doesn't invalidate that jj is good, in my opinion).
# on branch `feature`
# code code code
# whoops! Test missing
git add wip/ changes/ && git commit -m lol
git checkout develop
# write the test
git add test/ files/ && git commit -m lol2
# back to WIP branch
git checkout feature
# open vim and put the lol2 commit in the right place
git rebase -i develop
?lol2<cr>dd/3e7<cr>P:wq
# undo the original lol commit
git reset HEAD~1
You could use git stash instead of making and resetting the `lol` commit but i just prefer to do it this way.- It's distributed horticulture. Your tools come saran-wrapped to the tree.
- Rebase flow. Keep your branches linear.
- Merge commits are BS
- There is no source control problem that rebase, rebase --onto, reset, and reflog can't fix
- Topology is everything. Add this to your aliases: https://stackoverflow.com/questions/1838873/visualizing-bran...
TL;DR: Keep your branches up to date. Feature flags are a huge red flag. Constant conflicts and the inability to have long lived branches is indicative of poor architecture and project layout.
Use "rerere" as a bandaid.
Why won't anyone think about the release managers.
I am yet to see a real value to use JJ. Those kind of built-up posts I am seeing about JJ on HN tend to push me in the opposite direction.
1) do your test in your current branch, it's related to what you are doing. 2) commit, co master, co -b newtestbranch, PR it, merge in your branch after. You're going to squash rebase at the end anyway...
Related
A Better Merge Workflow with Jujutsu
A new merge workflow using Jujutsu, a modern VCS compatible with Git, introduces The Austin™ Mega Merge Strategy®. It simplifies merge commits, amending commits, and selecting commits efficiently, enhancing collaboration and code review processes with advanced commit graph manipulation.
Jujutsu: A Next Generation Replacement for Git
Jujutsu, an experimental version control system by Martin von Zweigbergk, offers Git compatibility, simplified commits, effective conflict handling, and features like automatic rebasing. Despite being in active development with some limitations, it shows promise for revolutionizing version control.
How I Use Git Worktrees
The author advocates for using Git worktrees to manage multiple coding tasks concurrently, highlighting their benefits over branches for context switching and productivity in software development.
Steve Klabnik's Tutorial on Jujutsu (Git replacement)
Steve's Jujutsu Tutorial is a beginner-friendly guide on the Jujutsu version control system, covering installation, commands, workflows, and advanced topics, while encouraging community engagement and feedback.
Jujutsu (jj), a Git compatible VCS
Jujutsu (jj) is a new Git-compatible version control system that simplifies workflows with a user-friendly interface, focusing on changesets. It is still under development, with some features lacking.