So we've got 2 primary branches: main (prod) and develop. We use GitHub. The develop branch is protected: You need a PR to change develop. So on production release: develop merges to main. The code is now identical, but those two branches are not the same commit. (main has an "extra" merge commit.) I can't push to get them on the same commit:
git:(develop) ✗ git merge origin/main --ff-only
Updating bf8228b..f9c3e42
Fast-forward
✗ git push
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: error: GH006: Protected branch update failed for refs/heads/develop.
remote: - Changes must be made through a pull request.
And I can't create a PR because GitHub doesn't allow a PR with 0 code changes. Just curious how others handle this. Seems visually ugly (git history) that they never become the same commit.
Visually cleaner: On production releases, main and develop are the same commit:
gitGraph
commit
commit
branch develop
checkout develop
commit
commit
checkout main
merge develop
commit
commit
Unfortunate GitHub reality: main and develop circle each other, but are never the same commit:
hmm... Mermaid can't really visualize --ff-only
? ... yes it can?
hmmm... kinda weird visualization of main on 3rd merge?
%%{init: { 'gitGraph': { 'mainBranchOrder': 2 }}}%%
gitGraph
commit
commit
branch develop order: 3
checkout develop
commit
commit
checkout main
merge develop
commit
commit
branch hotfix order: 1
commit
commit
checkout main
merge hotfix
checkout develop
merge main
checkout develop
commit
commit
checkout main
merge develop