Skip to content

Instantly share code, notes, and snippets.

@devinrhode2
Last active October 11, 2020 03:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devinrhode2/830813710b2089ae358ef0667e24fb82 to your computer and use it in GitHub Desktop.
Save devinrhode2/830813710b2089ae358ef0667e24fb82 to your computer and use it in GitHub Desktop.
fractal representation of git history

A squash merge will merge a branch, but leave behind a commit log of the squashed commits. So, inside of a squash merge commit, you have a message like:

Merge branch foo into bar

commit 1861807 (HEAD -> feature-1234)
Author: D.R <D.R@company.com>
Date:   Thu 09:05

    refactor(registraton/noop): no-op tweak (move hasWelcomeMessage)

commit e49c730 (origin/feature-1234)
Author: S.j <S.j@company.com>
Date:   Thu Sep 24 13:02

    refactor: 💡 foo

commit 896d751
Merge: af0d206 25d29b3
Author: P.N <P.N@company.com>
Date:   Wed 15:54 +0000

    Automatic merge from release -> develop

    * commit '25d29b3587a2fbe6f53c44074d78b2531e6c1b09':
      chore(release): v1.14.0

The crucial thing is that this commit message would need to be truly predictable. Maybe git log --porcelain format should be used, since that is meant for other programs to consume.

Say you have a CTO who has 4 teams, web, servers, android, ios.

Then there's a release team that manages releasing code from all these teams. They are not concerned with what some engineer did thursday at 3pm. All they know is that the teams release caused a bug, and they are rolling back that teams release. Then, the team that had a bad release can further investigate.

The release team COULD do a squash merge of all changes into some special release branch. This could generate an extremely large commit message, but... I hope you can see we have a method of preserving fractal history.

Of course, a branch that is squash merged cannot be deleted. The commit refs would then disappear. They could be archived, however: https://stackoverflow.com/questions/1307114/how-can-i-archive-git-branches

I think the best way to get a clean view of branches is by filtering with --no-merge master git branch --no-merge master will show you all chagnes that have not been merged into master yet.

Of course, not all tools (jenkins, bitbucket) will be able to show you a filtered list of branches

GUI tools could really help in visualizing such a fractal history.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment