Re:Oh Shit, Git?
by amanwithnoplan on Thursday January 16, 2025 @07:43PM
(#42732793)
Please kindly write one for a jj-specific issue: "my build vomitted out a bunch of files and I used any jj command before editing my .gitignore"
I've found myself using git to fix the mess in this particular instance.
$ jj file untrack {paths-or-pattern}
Alternatively if you have a bunch of files spewed everywhere with no rhyme or reason which can't be globbed or enumerated reasonably: $ jj status | grep '^A' | awk '{print $2}' | xargs jj file untrackOne thing I really appreciate is that you can run `jj new master` at _any_ time to drop what you're doing and start a new change. The way jj handles the working copy, conflicts, and visible heads means there's just no need to think about uncommitted changes, unfinished conflict resolution, detached head, etc.. So many things that would get in your way just can't happen.
I haven’t thought about it at all but you’re right. It’s surprising how nice it is that I can enter a repo and `jj new main` without needing to remember any context whatsoever.
My post was a pretty naked attempt to showcase how much less convoluted basic operations are in jj vs. git and hopefully drum up some interest. Hopefully someone bites.
Re:Oh Shit, Git?
by steveklabnik on Friday January 17, 2025 @02:40PM
(#42742399)
`jj new trunk()` is even better than `jj new main`, I just realized, ha!
2. "Accidentally committed something to master that should have been on a brand new branch".
This doesn't really have an analogue. Branches ("bookmarks") only move when you tell them to. If you make a new commit on top of master, it doesn't point master to it, it just lives one past the tip of master. But let's say you accidentally moved master to include the new commit you shouldn't have:
3. Move a commit from one branch to another. 4. Fuck this noise, I give up: Bonus content, translated from the article:> Oh shit, I committed and immediately realized I need to make one small change!
> Oh shit, I need to change the message on my last commit! > Oh shit, I tried to run a diff but nothing happened?! > Oh shit, I need to undo a commit from like 5 commits ago! > Oh shit, I need to undo my changes to a file! And finally there are a few things that are super easy/obvious in jujutsu that are far more annoying in git.> Oh shit, I committed and many commits later realized I need to make one small change!
> Oh shit, I committed and many commits later realized I need to make extensive changes! > Oh shit, I need to reorder two commits! > Oh shit, I haven't committed anything in hours but I need something from an interim change from like thirty minutes ago > Oh shit, I made a bunch of changes but want them to be in multiple commits (e.g., patch-add workflow) > Oh shit, I need to break out a change from my current work into a new branch off master > Oh shit, I need to make three sequential changes but roll them out one-by-one. I also might need to make fixes to previous ones before later ones are rolled out.