Skip to main content

Workflow Simulator

Challenge on lesson: Checkpoint: Professional Workflow

Write THREE functions. 1) resolveConflict(mine, theirs, strategy) where mine/theirs are conflict-halved code strings and strategy is "mine", "theirs", or "combine": return mine for "mine", theirs for "theirs", and for "combine" the string mine + "\n" + theirs (line-stacked). 2) chooseRecovery(pushed, othersPulled, wantHistory) — return "revert" when the commit was pushed AND others pulled it; return "reset" when it was not pushed; otherwise (pushed, nobody pulled, wantHistory true) return "merge"... but if pushed, not pulled, and wantHistory is false, return "reset". 3) bumpVersion(version, type) — given semver string "MAJOR.MINOR.PATCH" and conventional type, bump patch for "fix", minor for "feat", major for "feat!" or "BREAKING CHANGE"; return the new version string.

Difficulty: intermediate

Back to lesson: Checkpoint: Professional Workflow