Git-absorb: Git commit –fixup, but automatic
131–140 of 278 posts
Re: Git-absorb: Git commit –fixup, but automatic
#132Earlier quoted context omitted.
> The plot summary of the book is likely not what you should be reading as it's become an idiom. This is a good and perhaps under-appreciated point. When I first read the term "Polyanna" I made the same mistake as GP. I think if you read "The Prince" to find out what "Machiavellian" meant you'd be no better than when you started. Even terms like "Kafkaesque" have taken on lives of their own and are probably better no…
Machiavelli's "The Prince" will give you a decent understanding of what people usually mean by "Machiavellian". The book explains what methods would allow an absolute ruler to stay in control of state. It does not generally make moral judgments about those methods. Machiavelli's "Discourses" is the one that will really confuse a reader looking to understand the colloquial meaning of "Machiavellian". In this book, Mac…
> adjective
> uk /ˌmæk.i.əˈvel.i.ən/ us /ˌmæk.i.əˈvel.i.ən/
> using clever but often dishonest methods that deceive people so that you can win power or control
(from https://dictionary.cambridge.org/dictionary/english/machiave... )
Ymmv, but I think that's far from the point of the book, and isn't even the main topic. It's hard for me to imagine taking a person who'd never heard the term, letting them read the book, and then asking them to propose a definition, would produce anything like the above.
Re: Git-absorb: Git commit –fixup, but automatic
#133FWIW, I've been using this alias for the past couple years for fixup commits, and I've been happy with it: > gfx='git commit --fixup $(git log $(git merge-base main HEAD)..HEAD --oneline| fzf| cut -d" " -f1)' It shows you the commits on the current branch and lets you select one via fzf. It then creates the fixup commit based on the commit you selected.
If it only lets you select one, that's strictly less powerful. What if I want some parts of it into one commit and another parts into another? The `hg absorb` works for this case.
> What if I want some parts of it into one commit and another parts into another?
Looks like absorb will automatically break out every hunk into a separate fixup commit. My one-liner will create 1 fixup commit for everything that's staged. That's typically what I need, but on the occasions it's not, I use `git add -p`, as kadoban mentioned, to stage exactly what I want for each commit.
Re: Git-absorb: Git commit –fixup, but automatic
#134If i understand this will break "changes since my last review" and disconnect PR review comments in GitHub?
Re: Git-absorb: Git commit –fixup, but automatic
#135FWIW, I've been using this alias for the past couple years for fixup commits, and I've been happy with it: > gfx='git commit --fixup $(git log $(git merge-base main HEAD)..HEAD --oneline| fzf| cut -d" " -f1)' It shows you the commits on the current branch and lets you select one via fzf. It then creates the fixup commit based on the commit you selected.
sounds like how magit lets you create fixup commits in emacs
Re: Git-absorb: Git commit –fixup, but automatic
#136Maybe I am being to much of a purist, but retroactively modifying commits and history? Why? Stuff happens, so do mistakes. Fix the mistakes, make another commit, and go on with your life.
Why store git history at all? It's useless if you don't take care of it. Have you ever used git history for anything? People use it to find the source of regressions (you can do it quite quickly using git bisect).
And one key to good git history is people splitting up big PRs in multiple commits.
Re: Git-absorb: Git commit –fixup, but automatic
#137Do people actually check commit history in detail so often that they absolutely find so much value in ultra clean commit history? I never understood that obsession with 100% clean history.
Re: Git-absorb: Git commit –fixup, but automatic
#138Earlier quoted context omitted.
I see, the reason it’s that long complicated alias was that I didn’t want to open up the editor to change the commit every time I updated. “git commit —amend” does that. I read the rough how it works and it now makes sense. I might give it a try. Thanks!
Seems like you can add —no-edit and get the same behavior, now I can delete that alias. Thanks again :) (Edit: typo)
Re: Git-absorb: Git commit –fixup, but automatic
#139Earlier quoted context omitted.
I’ve been using autofixup for this and it’s been ok but not great, it can be quite slow as things grown, and it doesn’t say anything when there was no match so it’s easy to miss. How does absorb surface that? > Perhaps partially due to how GitHub works. That’s definitely a major factor, I’d like to use stacked PRs they sound really neat, but GitHub. Also even with stacked PRs I figure sometimes you’re at the top of t…
The term Stacked PRs already sounds like a term that was invented specifically in order to communicate in a GitHub-influenced context. Because Stacked PRs are just a reinvention of being able to review a commit at a time (the stack part is straightforward).
It has nothing to do with github.
Re: Git-absorb: Git commit –fixup, but automatic
#140Earlier quoted context omitted.
I assume you refer to https://github.com/torbiak/git-autofixup . I have also used it, and its ok but not perfect.
I use git autofixup; it was much better than git absorb last time I checked > it doesn’t say anything when there was no match that's what it should do > it can be quite slow as things grown How? All the slowness (on large repos) I've seen has been fixed.
No it is not.
> How?
I don’t know, that’s just an observation from using it, semi regularly I autofixup changes and it takes a while to do anything.