News for hackers. Stuff that matters.
Re:This is how I git by ufo on Tuesday November 10, 2020 @08:29AM (#25045678)
Does anyone know how to make this "cactus" workflow work better on github?

We use it in our organization and between us we know to always manually rebase before merging. However, when we receive an external PR from someone else it's a pain. It's also easy to accidentally forget to rebase before merging.

Re:This is how I git by divbzero on Tuesday November 10, 2020 @11:08AM (#25047519)
You can allow rebase merging [1] while disabling other PR options, and require linear commit history [2] if desired.

[1]: https://docs.github.com/en/free-pro-team@latest/github/admin...

[2]: https://docs.github.com/en/free-pro-team@latest/github/admin...

Re:This is how I git by ufo on Tuesday November 10, 2020 @11:21AM (#25047676)
Thanks, but I don't think that is quite what I want. What I mean by "cactus" history is that the feature branches have a linear history that starts at the tip of the master branch but when we merge them back into master we still use a merge commit. Looks like this:

      o-o-o   o-o-o   o-o
     /     \ /     \ /   \
    o-------o-------o-----o
We like doing that because, as the grandparent poster said, it clearly delineates the point where each PR was merged. AFAIK, the Gihub option to require a linear history assumes that you would want to flatten all the commits without any merge commits at all:

    o-o-o--o-o-o--o-o
Re:This is how I git by karyon on Tuesday November 10, 2020 @12:01PM (#25048145)
I don't know a way to enforce this, but what may help is knowing that by default, you can push into the PR branch even if it is from someone else's fork: https://docs.github.com/en/free-pro-team@latest/github/colla...
Re:This is how I git by tele_ski on Tuesday November 10, 2020 @10:29AM (#25047001)
I always go into each new repo I create and turn off the ability to merge and require commits to be up to date with master, I think this might get what you want?
Re:This is how I git by ufo on Tuesday November 10, 2020 @11:27AM (#25047742)
Do you know can I enforce that a PR must be up to date with master before it can be merged? I don't remember seeing that option in the branch protection settings.
Re:This is how I git by tele_ski on Tuesday November 10, 2020 @05:07PM (#25052684)
"Require branches to be up to date before merging" is a check box under branch protection rules, I always turn it it. It's under the required status checks section.
Re:This is how I git by ufo on Tuesday November 10, 2020 @05:49PM (#25053144)
Thanks! Turns out that this setting is hidden unless you first check the "Require status checks" option.
Re:This is how I git by tele_ski on Tuesday November 10, 2020 @06:55PM (#25053766)
Oh good to know! I forgot it's hidden until that section is enabled. Does feel like a feature that should be top level, OSIT!