Skip to content

Instantly share code, notes, and snippets.

@lsloan
Last active February 27, 2018 22:27
Show Gist options
  • Save lsloan/c4e0fbcb56d5cf83bf96 to your computer and use it in GitHub Desktop.
Save lsloan/c4e0fbcb56d5cf83bf96 to your computer and use it in GitHub Desktop.
Diagram of a common GitHub workflow (short URL: https://goo.gl/79JCB9)
digraph G {
label = "GitHub Workflow\nSource: https://goo.gl/79JCB9"
labelloc = "t"
subgraph cluster_upstream {
label = upstream
style = filled
color = lightgrey
node [style = filled color = white]
upstreamMaster0 [label = master]
upstreamMaster1 [label = master]
pullRequest [label = "pull request" shape = box]
// Invisible links to establish node order within cluster.
upstreamMaster0 -> pullRequest -> upstreamMaster1 [style = invis]
}
subgraph cluster_fork {
label = fork
node [style = filled]
color = blue
forkMaster0 [label = master]
forkMaster1 [label = master]
forkBranch0 [label = branch]
forkBranch1 [label = branch]
forkBranchDelete [label = "delete branch\n(optional)"
shape = box peripheries = 2]
// Invisible links to establish node order within cluster.
forkMaster0 -> forkBranch0 -> forkBranch1 -> forkMaster1 ->
forkBranchDelete [style = invis]
}
subgraph cluster_local {
label = local
node [style = filled]
color = red
localMaster0 [label = master]
localMaster1 [label = master]
localBranch0 [label = branch]
localBranch1 [label = branch]
localBranchDelete [label = "delete branch\n(optional)"
shape = box peripheries = 2]
// Invisible links to establish node order within cluster.
localMaster0 -> localBranch0 -> localBranch1 ->
localMaster1 -> localBranchDelete [style = invis]
}
start [shape = Mdiamond]
end [shape = Msquare]
// Undocumented (?) "newrank" enables "rank = same" directives
newrank = true
// If ranks are specified before node and cluster definitions,
// nodes are not shown in their correct styles.
{rank = same upstreamMaster0 forkMaster0 localMaster0}
{rank = same forkBranch0 localBranch0}
{rank = same forkBranch1 localBranch1 pullRequest}
{rank = same upstreamMaster1 localMaster1}
{rank = same forkBranchDelete localBranchDelete}
start -> upstreamMaster0
upstreamMaster0 -> forkMaster0 [label = fork]
forkMaster0 -> forkBranch0 [label = branch]
forkMaster0 -> localMaster0 [label = clone]
forkBranch0 -> localBranch0 [label = clone]
localBranch0 -> localBranch0 [label = work]
localBranch0 -> localBranch1 [label = commit]
localBranch1 -> forkBranch1 [label = push]
pullRequest -> upstreamMaster0 [style = dashed]
pullRequest -> forkBranch1 [style = dashed]
pullRequest -> upstreamMaster1 [label = merge]
upstreamMaster1 -> localMaster1 [label = pull]
localMaster1 -> forkMaster1 [label = push]
forkMaster1 -> forkBranchDelete
forkBranchDelete -> localBranchDelete [color = "black:black" dir = none]
forkBranchDelete -> end
//localBranchDelete -> end
}
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lsloan
Copy link
Author

lsloan commented May 27, 2015

I'm not positive that the fork branch deletion is represented properly. For one thing, it should be shown to come after the branch and the upstream master have been merged. I'm not sure how to indicate that neatly and without making the graph taller. I don't like how the deletion is shown graphically, either.

@lsloan
Copy link
Author

lsloan commented Jun 12, 2015

I've resolved the problems with placement and representation of branch deletion in the fork and local copies.

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