2 ms·
>I mean, that's option 2 of what you're quoting, No, option 2 is to stash. Their three weird options are: (a) fix the bug on the feature branch and "try to g
by coldtea 3y ago
>I mean, that's option 2 of what you're quoting,
No, option 2 is to stash.
Their three weird options are:
(a) fix the bug on the feature branch and "try to get them both deployed together"
(b) git stash, fix the bug in a new branch, come back
(c) locally clone the repository
At least (b) is somewhat sane, but it's still weird that the even more code-managementy option of "commit your halfway feature work/create new branch for the bugfix/come back to the feature and amend/squash/soft reset" isn't even mentioned.
Your cases are more involved than the contrived scenario you give, where their weird options don't make sense.
- MaulingMonkey 3y ago> "commit your halfway feature work/.../come back to the feature and amend/squash/soft reset" ...this is just by-hand stashing with alternative commands and extra "WIP" commit messages. Which, uh, is admittedly an option. One that won't easily preserve your index independently from your working tree - awkward if you're in the middle of painstakingly separating out changes to add to the next commit with `git add -p` - and one that risks "WIP" commits ending up in your tree... but it is an option.
- avgcorrection 3y agoIMO you don’t need anything more than commits. The by-hand is writing WIP in the commit message. If that is an inconvenience then I’ll make a commit alias. The index + commits is flexible enough. The stash concept is not needed for me. See: https://news.ycombinator.com/item?id=39606525 https://news.ycombinator.com/item?id=39606525
- avgcorrection 3y agoI think that you (like me) prefer to use commits in places where many others prefer to stash. Personally I think the stash command is too primitive to bother with for all things except maybe an push+pop that happens within half a minute. Anything more and I risk forgetting about it. A WIP commit however is just there, on the branch, for me to deal with however I want later. I don’t want to fiddle with dropping the stash one too many times, forgetting what they were about and so on. Merge conflicts because I didn’t pop before resuming.. It’s just a mostly useless additional “thing”.
- avgcorrection 3y agoAmendment: I just found out that I do have at least one use for git-stash, which is when I am stuck in the middle of a rebase somewhere and made an edit intended for another point (commit).