rstats-wtf / wtf-2020-rsc

https://rstd.io/wtf-2020-rsc
Creative Commons Attribution Share Alike 4.0 International
49 stars 31 forks source link

Parking interim work in a branch, the post hoc version #19

Open jennybc opened 4 years ago

jennybc commented 4 years ago

Possible addition to the intermediate workflows lesson:

When you belatedly recognize you should have been working in a branch. You're working on master, intending to X. But then X becomes much more involved than you anticipated. Or you got sidetracked by Y. In any case, you find yourself with lots of unrelated changes and you've taken everything apart but not put it back together nicely again. You may or may not have committed (usually not) and pushed (almost certainly not). BACK OUT! But without throwing away this work (yet).

What now? Commit the whole mess as "WIP". Create (and checkout) a messy-wip branch for the current mess. Checkout master. Hard reset to the commit where you should have branched, which is almost certainly the last commit you pushed.

Create a new well-named, well-scoped branch and gradually implement what you learned in messy-wip. And/or make a series of small, well-scoped commit to master streamlining the circuitous route travelled in messy-wip branch. Once all the good stuff learned done in messy-wip is better represented in master or the new feature branch, delete it.