News for hackers. Stuff that matters.
Re:Extremely Linear Git History by benatkin on Tuesday November 22, 2022 @12:42PM (#33708517)
Proper use of merge is table stakes. You get warned in your PR if your non-main branch is out of date with your main branch, and after you rebase and force push your non-main branch, you review the diff in the PR.
Re:Extremely Linear Git History by couchand on Tuesday November 22, 2022 @01:32PM (#33709188)
Then you don't actually need merge? Am I missing something?

If you always rebase the branch, the commits can be applied directly.

Re:Extremely Linear Git History by xxpor on Tuesday November 22, 2022 @03:22PM (#33710935)
if you do this:

(starting on main)

git checkout -b feature

do work

git commit -a

git checkout main

git pull

git checkout feature

git rebase main

publish code review, get approval

git checkout main

git merge feature

You still use merge at the end, even though it's not actually doing anything that'll result in a conflict.

Re:Extremely Linear Git History by couchand on Tuesday November 22, 2022 @03:31PM (#33711065)
Totally on board (except the forbidden -a switch).

The last command is:

    cp .git/refs/heads/feature .git/refs/heads/main
No merge needed.
Re:Extremely Linear Git History by xxpor on Tuesday November 22, 2022 @03:38PM (#33711153)
Touching files in .git (outside of like, .git/config) directly gives me the heebee jeebees
Re:Extremely Linear Git History by couchand on Tuesday November 22, 2022 @04:48PM (#33712012)
Fair point, and I would not advocate that specific workflow! My point was just to illustrate that we can live without merge.
Re:Extremely Linear Git History by a_t48 on Tuesday November 22, 2022 @07:47PM (#33713642)

    git reset --hard main feature
Re:Extremely Linear Git History by micw on Tuesday November 22, 2022 @03:52PM (#33711343)
Rather than switching to "main" and pull it, you can just stay in "feature" and do a fetch followed by "rebase origin/main". Then pull "main" before you merge the feature.

I'd also use "merge --no-ff" to force an empty commit that visualizes where a feature begins and ends.

Re:Extremely Linear Git History by benatkin on Wednesday November 23, 2022 @12:38AM (#33715639)
You're missing the merge commits. `git log` is a key feature and merges belong there, at least in my workflow.