▲ | My new Git utility `what-changed-twice` needs a new name(blog.plover.com) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
79 points by jamesbowman 14 hours ago | 42 comments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | GuB-42 10 hours ago | parent | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Why does it needs a new name? I had a good idea of what it did before reading the article, it is a long name but not Java-long, and none of the suggestions so far are clear to me, even after reading the article. The only somewhat confusing part is the "twice", because it can be more than twice. But if you think about it, if it has been changed more than twice, it had to be changed twice at some point, so it is not totally wrong. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | gorgoiler 4 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Tools like this are also useful if you need to cherry pick a patch onto a release branch and want to know potential dependencies:
In this example, if the release needs the fix in D you’ll also need to cherry pick the rewrite in B.You get false positives and false negatives: if B fixed a comment typo for example it’s not really a dependency, and if C updated a module imported in the new code in D you’d miss it. (For the latter, in Python at least, you can build an import DAG with ast. It’s a really useful module and is incredibly fast!) So I would say the author’s tool is really multiple tools: 1/ build a dependency graph between commits based on file changes in a range of commits; 2/ automate the reordering and squashing of dependent commits on a private dev branch; 3/ automate cherry-picking commits onto a proposed release branch (which is basically the same as git-rebase -i); and 4/ build a dependency graph based on external analysis (in my example, Python module imports) rather than / as well as file changes. Their use case is (1) and (2), (3) is a similar but slightly different tool to (2), and (4) is a language specific nicety that goes beyond the scope of simple git changes for, arguably, diminished returns. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | squeaky-clean 10 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"what-changed-twice" tells me exactly what the command does. "squash-what" tells me nothing, why is the program name asking me what to squash, and then why does it not squash? The only inaccuracy I can think of in the name is that it's technically "what-changed-more-than-once." But if something has changed thrice, by definition it's also been changed twice. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | handsclean 4 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I suggest group-commits-by-file , group-commits , or group-by-file, depending on whether you want it to make sense out of context and whether you ever group commits differently. You might then feel compelled to add a final line like “… and 12 files with 1 commit each”, or even to enumerate them, which sounds like it’d be useful anyway. “what” isn’t doing any work, there’s already an implicit “what” in the call-response paradigm. “Changed” implies you’re detecting changes, but you’re not, you’re operating on a data structure that happens to represent changes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | codewritero 12 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Jujutsu has a command which is helpful for this sort of workflow called absorb which pushes all changes from the current commit into the most recent commit which modified that file. (Each file may be merged into a different commit). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | eru 11 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> There's bonus information too. If a commit is not mentioned in the report, then it only changed files that didn't change in any other commit. That means that in a rebase, I can move that commit literally anywhere else in the sequence without creating a conflict. Only the commits in the report can cause conflicts if they are reordered. This is only true in the textual level. Semantically, re-shuffling commits like this can still cause conflicts. Ie it can break your tests. Not at the end, but for the intermediate commits. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | MontagFTB 11 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I am familiar with an algorithm that stably brings a disjoint selection of items together around a specified point. Sounds similar to this case, where the disjoint selection are changes that happened to a given file. The name of the algorithm is “gather”, by Sean Parent and Marshall Clow. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | nferraz 2 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Why did you opt for "highly-abbreviated commit IDs"? Instead of: ``` calendar/seasons.blog 196 40 d1
```The tool should simply display: ``` calendar/seasons.blog 196e749 40c52f4 d142598 ``` That's it! The second table only complicates the output. PS: `what-changed-twice` is a good name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | quuxplusone 8 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Suggestion: `git squash-report`. (Or `git rebase-report`, except I wouldn't call it that because it would interfere with my tab-completion of, and/or muscle memory of, `git rebase -i`.) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | zahlman 9 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
When I make Bash aliases or functions for Git functionality, I always name them as `git-something-or-other`. That way they're namespaced in a way that I find pleasant both for tab completion and for easy of memory. I think that should apply to more complex utilities, too. By my usual naming conventions, this one would be `git-repeatedly-changed`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | allseeingimei 11 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
git-delta -n <times> i.e. git-delta -n 2 = 'what changed twice' or if its just what changed twice in every case then just 'git-delta-delta' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | protocolture 9 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Double Jeopardy? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | st3fan 9 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Oidia- Oops I did it again | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | chris_wot 12 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
You know, I find myself partially agreeing that a number of utilities for git could be done quite nicely in perl. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | atoav 7 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
No it does not. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | pfannkuchen 6 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
change-cluster? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | nicr_22 11 hours ago | parent | prev [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FlipFlopStop? FFS for short, which has suitably disgruntled other exclamatory meanings. |