How do I put a bunch of uncommitted changes aside while working on something else

前端 未结 4 1073
夕颜
夕颜 2021-01-30 02:49

If I have a bunch of uncommitted changes and want to set it aside while working on something else instead, and then later (f.i. after several days) come back to it and proceed w

4条回答
  •  无人共我
    2021-01-30 03:17

    You can just clone your repo multiple times. I tend to have a root clone, then multiple childs from there. Example:

    • MyProject.Root
    • MyProject.BugFix1
    • MyProject.BugFix2
    • MyProject.FeatureChange1
    • MyProject.FeatureChange2

    The 4 childs are all cloned from the root and push/pull to/from the root. The root then push/pulls from the master repo on the network/internet somewhere. The root acts as your sort of personal staging area.

    So in your case, you'd just clone up a new repo and start working. Leave your 'shelved' work alone in the other repo. It's that simple.

    The only downside is disk space usage, but if that were a concern you'd not be using DVCS at all anyway ;) Oh and it does kind of pollute your Visual Studio "recent projects" list, but what the hey.

    [Edit following comments] :-

    To conclude then... what you're doing is completely fine and normal. I would argue it is the best possible way to work when the following are true: 1) it is short-lived 2) you don't need to collaborate with other developers 3) the changes don't need to leave your PC until commit/push time.

提交回复
热议问题