Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    git config pull.rebase true
    git config rebase.autoStash true
I think these should have been the defaults but they weren't implemented until later and it's hard to change defaults.


Setting rebase to true by default is not a good idea if you push your code to your dev branch regularly (rather than just committing).


I think that's a bit of an exaggeration; "pull.rebase=true" should be fine as long as you don't have local merge commits that need to be rebased on top of someone else's changes. With ordinary commits, it shouldn't really matter how frequently you (or others) push.


"git rebase" has --preserve-merges (apparently renamed to --rebase-merges a few years ago) to recreate those local merge commits, maybe it can be set somehow for this as well?


Exactly. That’s the default I use. You can set it via:

    git config --global pull.rebase merges


Great to know about these. I still think the current default is better: for a new user, it might be scary for your uncommitted changes to "vanish" into a stash.


The stash is popped before the command finishes, so your changes don't appear to vanish. Unless there's a conflict while rebasing a prior commit. Actually I'm not sure if aborting the rebase at that point would pop the autostash, but it should.


Got it. In that case I agree.


TIL. Thank you for this!




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: