5 ms·
Rewrite Git history via drag-and-drop
- tmountain 2y agoI would rather have a messy commit history with all of the value that an audit trail brings va a clean history that purges said context.
- leoqa 2y agoHere ya go: commit f5b5bd8f9eaa443d4020cbe918x742e7ddd22000 Author : John Doe <John.Doe@mail.com> Date: Mon May 22 14:21:03 2023 -0400. merge main commit f5b5bd8f9eaa443d4020cbe918x742e7ddd22000 Author : John Doe <John.Doe@mail.com> Date: Mon May 22 14:21:03 2023 -0400. fml commit f5b5bd8f9eaa443d4020cbe918x742e7ddd22000 Author : John Doe <John.Doe@mail.com> Date: Mon May 22 14:21:03 2023 -0400. fix 2 commit f5b5bd8f9eaa443d4020cbe918x742e7ddd22000 Author : John Doe <John.Doe@mail.com> Date: Mon May 22 14:21:03 2023 -0400. fix 1 commit f5b5bd8f9eaa443d4020cbe918x742e7ddd22000 Author : John Doe <John.Doe@mail.com> Date: Mon May 22 14:21:03 2023 -0400. CI fix commit f5b5bd8f9eaa443d4020cbe918x742e7ddd22000 Author : John Doe <John.Doe@mail.com> Date: Mon May 22 14:21:03 2023 -0400. PR comments commit f5b5bd8f9eaa443d4020cbe918x742e7ddd22000 Author : John Doe <John.Doe@mail.com> Date: Mon May 22 14:21:03 2023 -0400. Linter commit f5b5bd8f9eaa443d4020cbe918x742e7ddd22000 Author : John Doe <John.Doe@mail.com> Date: Mon May 22 14:21:03 2023 -0400. Fix test commit f5b5bd8f9eaa443d4020cbe918x742e7ddd22000 Author : John Doe <John.Doe@mail.com> Date: Mon May 22 14:21:03 2023 -0400. Implement new SSO feature
- yjftsjthsd-h 2y agoSo? Even without good commit messages `git blame` will tell us who touched what and when.
- dzaima 2y agoNot necessarily; if one commit touches all lines (or a bunch), and another reverts that, the blame is thrashed; much worse than having rebased the temp change away. And a commit name of "." is quite significantly less useful in a git blame than "Rewrite foo to use new thing" when looking at reasons for why foo might have broken.
- WolfeReader 2y agoIs the reuse of the commit hash and date intentional and part of the joke? Besides that, I like seeing and preserving this kind of history. And when I don't want to, there are ways to filter the logs.
- falcojr 2y agoHow is a "PR comments" commit useful to you? If I'm looking at history, it's usually to see: 1. What caused a bug 2. Context around a feature and why it was written a certain way Seeing a "PR comments" commit just turns into noise. It also makes me gather 10 commits together to try to piece back together the unit of work that was built. I just see no value in preserving this type of noise.
- WolfeReader 2y agoThat is a perfect example. The "PR comments" commit helps me see what the dev considered most important (code before this commit), and what the rest of the team considered lacking (the content of this commit). Thus, the Git history records a facet of the team culture at the time of the commit.
- leoqa 2y agoIn my experience the merge commit is simply a reference to the PR, which has all the context. The title of the PR is effectively the commit summary.
- eviks 2y agoNo, you're making up that story and that culture, and when you lose this spurious foundation, you'll just as easily make up some other story based on any other random data. For example, reality could've been that there was no team involved at all and all those changes came to the original person the moment he made the PR. And the "PR comments" could just as easily refer to his own comments he added during when checking those CI messages and noticing something else and commenting on that not to forget.
- dzaima 2y ago
- whoomp12342 2y agodesign flaws as a feature: I like that rewriting git history is hard. immutable history is a good thing from an auditing perspective when you are in a centralized flow
- dmitshur 2y agoHopefully this is mostly intended to rewrite/polish local history, before it’s pushed upstream.
- thunky 2y agoThis looks like a nice tool, but I agree with GP because as a reviewer I don't care about a "clean" commit history in a branch I'm reviewing. I care about what's changed, and imo the request description/annotations can describe that in plain language better than a commit history can tell a story.
- corytheboyd 2y agoYou need to look further ahead than that though. A sane git history makes debugging much easier. When you bisect your way to a problem area, sure is nice when the suspect lines of code fall into a 10 line change commit with a nice message and body providing context. I’ll let it slide if the PR/MR has a lot of good context, because it’s trivial to link those back to commits/lines.
- mvonballmo 2y agoI also think we should be thinking more long-term. How understandable is the history when you're trying to figure out why something changed? I usually try to tell the story of what changes are being made rather than treating every clump of commits as a "PR" that's just going to be squashed together anyway. I think a lot of valuable information is lost by doing that. But I realize that that train has left the station for most, so I'll just shut up now.
- whoomp12342 2y ago
- dmitshur 2y agoThis seems similar to Sublime Merge. It’ll be interesting to hear a comparison from someone who’s used both.
- Uvix 2y agoThanks for the pointer - Retcon sounds useful but I don't have a Mac. I'll have to give Sublime Merge a try the next time I need to do some rewriting...
- 0x696C6961 2y agoI use sublime-merge as a daily driver. AFAIK, it doesn't have a comparable feature for re-ordering commits.
- akdor1154 2y agoI use Merge, but i don't use it for anything more than trivial rebasing. I'll split commits in merge then just go run `git rebase -i`. What i want is for something to have a plan-THEN-act approach to rebasing. Like GParted, or... `git rebase -i`.
- mhld 2y agoClean landing page -> clean product. What's the meaning behind the name 'retcon'?
- IshKebab 2y agoVery slick! But tbh this isn't the difficult part, conflicts are. I suspect not many people will pay for a GUI interface to `git rebase -i`. If you can make merge conflicts less dumb then I'm there!
- gear54rus 2y ago> many people will pay for a GUI interface Then many people should purchase SmartGit client. Which supports more of the same thing (with couple more clicks, granted) but also has a proper tree view. Also supports linux ffs. Never working with git without it again.
- onionisafruit 2y agoI’m happy with Jetbrains conflict resolution, but the I’ve never tried SmartGit for comparison. It would take a lot for me to move because I already pay for Jetbrains IDE.
- harrall 2y agoI don’t think SmartGit will elevate you that much but JetBrains IDEs and SmartGit are the only two tools I pay for and have for 8 years with no regrets. I already posted in this thread but I just love these two tools and wish more people knew about both of them.
- mvonballmo 2y ago+1 for SmartGit. It's much more intuitive and flexible than the JetBrains UI, which still inherits so much terminology and behavior from its "unified" view that includes being able to handle Perforce changelists. It's a bit of a mess and generally trips new users up more than it helps. If you're comfortable with it, then good for you but I've had a lot of students not being able to grok it really well.
- onionisafruit 2y ago
- brianzelip 2y agoHere's a recent informing podcast episode about Retcon with its author, https://www.devtools.fm/episode/116 https://www.devtools.fm/episode/116
- SAI_Peregrinus 2y agoIt'd be nice if there were a GUI way to rebase by dragging links in a graphical view of the DAG. This program seems to allow reordering commits, but it's not clear how well it handles the more complex cases.
- Karliss 2y agoIf I am not mistaken Git Kraken has a limited version of that.
- SAI_Peregrinus 2y agoHaving used it, no, it doesn't. At least not that I could find. Last tried it about a year ago though, so they might have added it. IIRC it was just pretty graphics over exposed `git` workflows, instead of any higher-level abstractions.
- Karliss 2y agoSee the animation https://www.gitkraken.com/learn/git/git-rebase#how-to-git-rebase-with-gitkraken-client https://www.gitkraken.com/learn/git/git-rebase#how-to-git-re... . It is very limited as I said (happens at the branch level not individual commits and you can't choose base), but at least it solves one of the most annoying (but solvable) parts for me - remembering which of the 3 arguments for "git rebase" is which and in what order they go. Even in GUI clients where you have single "rebase" button interacting with current branch it's not always fully obvious whether it will rebase current branch or on top of current branch. Of course it's not hard to imagine how a program could potentially do a lot more. And I would understand if compared to that you called the functionality GitKraken provides as having nothing at all.
- tobyhinloopen 2y agoCool, but I'm not going to pay with a subscription lol. This is a tool I'd pay 20$ for, at most. (once, absolutely not monthly or yearly) and only without any of the "up to X devices" shenanigans.
- romellem 2y agoAgreed. I’d pay for this (I pay for [Fork][1]), but never as a subscription. [1]: https://git-fork.com https://git-fork.com
- lintfordpickle 2y agoI was contemplating writing something similar, but am often hesitant to post negative comments, but the pricing (without even considering the user and seat restrictions) of this is just crazy considering it's ultimately a GUI wrapper of the CLI tool.
- 0x696C6961 2y agoYeah, I don't get who's going to be paying $10 a month for a nicer `git rebase -i`
- eviks 2y agoGreat idea, one more step towards Copy&Paste to achieve the same. Treat commits as files in a file manager from the UI perspective
- setopt 2y agoIs there a GitFS exposing Git commit history as a FUSE file system?
- incognito124 2y agoYou're in luck! git history is already built on top of as filesystem
- setopt 2y agoTechnically correct :p But I’d be pretty scared to go and change the contents of .git by hand ;)
- smusamashah 2y agoFYI smartgit does that. Also in IntelliJ's git ui, the rebase option allows drag drop of commits.
- harrall 2y agoIntelliJ and SmartGit are my two favorite tools. SmartGit has had drag and drop for a long time. I actually rarely use it but there is almost no Git problem I can’t fix in like 2 clicks.
- smusamashah 2y agoMoreover, both let you select and skip individual lines/chunks from a commit. As in when selecting files to commit, you can choose which changed lines you want in that commit.
- lijok 2y agoReading "rewrite history" sets off so many red flags for me I struggle to take this seriously. What are you trying to do? Are you embarrassed that you arrived at an end goal via a suboptimal sequence of steps, and are trying to present it in a way that conceals that fact? Is the auditor at the door? What's the end goal here?
- PhilipRoman 2y agoMaintaining forks/extensions of opensource upstream projects is a pretty good use for it.
- lijok 2y agoInteresting, could you elaborate? I'm unfamiliar with that usecase
- PhilipRoman 2y agoI've maintained an internal fork of "hostapd" tool. We needed a bunch of additional WiFi features and in some places different behavior due to hardware architecture. Initially it had a normal Git history, which made it a pain to update (as a consequence, this was not done at all except for cherry picking security fixes). Merging any significant upstream changes was impossible and all clients would be limited to using our exact hostapd codebase. The solution was to identify our changes, split them into meaningful feature commits, keeping upstream and our code as separate as possible. After this change, updating the upstream by ~2 years took about 4 days. Most importantly, the history is kept clean by marking what commits go where, and doing cleanup every couple of months (no code diffs are allowed at that moment, only git history may be rewritten). The new history can also be exported as patches, so that any client can (selectively) apply them on top of their own hostapd.
- falcojr 2y agoRewriting history on main is bad. Rewriting history everywhere else is completely normal and should be encouraged. I don't want your "oops typo LOL" commits in main. I don't want a history that looks like "refactor stuff"->"new feature"->"1 line change to that thing I refactored". That one line change should go into the old commit. Fix all of that before you merge to main.
- xnorswap 2y agoOK, I don't get it. There's lots of praise for this though so I must be missing something that lots of other people get value from, so perhaps someone could be kind enough to explain where's the benefit to this? I'm fine with the history capturing what has actually happened. a Git history isn't something that is supposed to be admired as if it were a work of art. The git history is the scaffolding, not the cathedral itself. Even the source code isn't the cathedral, that's more super-structure. The product is the goal.
- parhamn 2y agoI don't get your point. Sure, the git log isnt the "cathedral", but also being able to change things quickly doesn't imply or necessitate this.
- xnorswap 2y agoMy point is that I don't understand where the driving force for desiring to change it at all is coming from.
- dzaima 2y agoGit blame and bisect do care about the state of specific commits. During development of a thing it should be desirable to be able to handle/test just whatever the current thing is and clean up afterwards if necessary, without having to completely drop ability to use git. But this can impact later bisects - having temporary printf("fuck sadjkoisajhdfo")s spamming outputs, project entirely not building on a configuration that wasn't cared about at the moment (or worse, build successfully, but function off enough that it's not obvious that the commit was not intended to be touched). And then there's the general thing of having a feature that you had been working on, but want to move it to some other branch. Or you committed things out of order and the committed order doesn't actually build in the middle. Or you didn't commit some file/change and thus have a sequence of ten completely-non-sensical non-functional commits. The inverse question deserves asking - why would you want to leave in your primary commit history things not meant to ever be looked at?
- 2y ago
- lzzzam 2y agoQUESTION: How does this handle merge conflict when rewriting the history??
- Cykelero 2y agoIf there's a conflict, Retcon shows that to you, but you can keep freely moving commits around—it's not blocking. Once you're happy with how your history looks like, you can start actually resolving any remaining conflicts, and after that the history gets actually written. Sometimes, just moving things around further is enough to resolve the conflicts, too, if they're simple enough!
- elAhmo 2y agoDo people end up rewriting git history often? I think I had to do a handful of times only, so it is really hard to merit a tool that requires an annual subscription to do this. Additionally, Sublime Merge seems to have significantly more features with fairly similar UI.
- deleted 2y ago[deleted]
- zffr 2y agoIn what scenarios would you want to re-order commits?
- jamalaramala 2y agoSometimes, before you merge your changes into master, you may want to re-organize your commits in logical chunks. For example, if you are working in two different files -- you can reorder the commits so they appear together, and then combine them if that makes sense.
- spleen123 2y agoWhy not git-butler, I find that tool very useful for this task!
- ilyagr 2y agoTo save people a search: https://gitbutler.com/ https://gitbutler.com/
- pdpi 2y agoI've been using Sublime Merge for exactly this purpose since around when it was first launched.
- Pet_Ant 2y agoI want to be able to split a single commit into multiple commits. I sometimes mix clean-up changes with core logic changes in a single commit. That is something I'd pay for. To be able to just drag'n'drop the files from commit to commit. Especially if I could split changes within a file between commits. Something more powerful than the partial commits of Intellij.
- pimlottc 2y agoYou can do this, via the command line at least, using `git rebase`: https://stackoverflow.com/a/6217314 https://stackoverflow.com/a/6217314
- 3np 2y agoThe way I do this, I duplicate each entry for the commit-under-splitting N+1 times when splitting it into N parts. Then for each, I manually edit the commit to its desired state during the interactive rebase, and then the last one should be empty (or only consist of leftover changes that should be dropped).
- WolfeReader 2y ago(Assuming you haven't already pushed to remote) Create a new branch, called "preSplit", at the commit where you want to split. Take your actual branch and reset it to one commit prior. Grab the first set of changes you want from "preSplit" and commit. Repeat until each distinct set of changes has its own commit. If needed, rebase commits after "preSplit" onto your current branch. I'll do it for you, for a modest fee!
- corytheboyd 2y agoLazygit patches are a great way to do this. You can interactively select lines from commits to “pull out” making them easy to form new commits with. Takes some getting used to, but it is the exact flow you are talking about. https://github.com/jesseduffield/lazygit?tab=readme-ov-file#rebase-magic-custom-patches https://github.com/jesseduffield/lazygit?tab=readme-ov-file#... Oh you edited to say drag and drop. Lazygit is a TUI and patches are very much keyboard driven. Still worth thinking about? It’s free!
- dugmartin 2y agoJust curious what you used to generate the video? I like the per pill progress bars.
- Cykelero 2y agoThank you! It's a regular video recording, and then I noted down the chapter timestamps in an array. (see heroVideoChapterStartTimesSeconds at the very top of https://retcon.app/main.js https://retcon.app/main.js) As the video is playing, the player uses this to know what chapter to highlight, and how much to fill its progress bar. (that's updateVideoChapters())
- logicziller 2y agoThe UX looks quite decent, but I think it should also have an indicator next to each commit to show whether it was already pushed or not so you can avoid doing a force push.
- Alifatisk 2y agoIs there no way to pay once and keep forever? Also, will it be available through homebrew? Why is everything turning into subscription based? I understand that it is more favorable for the creator but I can't imagine having to pay monthly for everything I use. Imagine one day when my economy gets strangled, do I loose everything I can't afford subscribe to anymore?
- Cykelero 2y agoTotally understand the dislike for subscriptions. I did go that way because it makes it much likelier I'll be able to work on the app long-term (which I'd really like!). Retcon's actually already available on Homebrew—someone kindly added it, unprompted!
- Alifatisk 2y agoI understand your reasoning