4 ms·
An example that happened to me recently regarding a git problem: I had a few changed files in a working directory. I did `git add -A` to stage them. I then i
by fishtoaster 11y ago
An example that happened to me recently regarding a git problem:
I had a few changed files in a working directory. I did `git add -A` to stage them. I then intended to `git stash` those changes, but I accidentally did `git stash pop`. I now have two sets of unrelated changes checked out: one staged and one not. I'd like to just stash the staged changes for now, but I don't know how to do that off the top of my head.
Google brings up this answer: http://stackoverflow.com/questions/14759748/stashing-only-staged-changes-in-git-is-it-possible http://stackoverflow.com/questions/14759748/stashing-only-st...
The original poster asks pretty much what I'd like to know: "How can I stash only staged changes?" However, he also provides some background. It sounds like he legitimately has an XY problem here, and the top answer is a long discussion of alternate workflows. However, when I search for something like "git stash only staged", I get a very unhelpful answer.
- zajd 11y agoBut that's not what he asks, that's just one of the many questions he puts forth, including this one at the end: "Am I going about this the wrong way? Am I misunderstanding how git can work in other ways to simplify my process?" Which is answered correctly. It could have been a typical XY problem but he adds enough background information that he's able to get a better answer. Great question AND great answer. I'll give you that Google didn't index that question particularly well, but that's not really StackOverflow's fault.