8 ms·
Finally there is `git stash --staged` and I can stop making temporary commits which I might forget about later and accidentially push.
by clktmr 5y ago
Finally there is `git stash --staged` and I can stop making temporary commits which I might forget about later and accidentially push.
- globular-toast 5y agoWoah, it didn't already? Magit has made that easy forever and I just assumed it was part of git at this point.
- adamrt 5y agoHah, I was thinking the same thing and jumped to comments to see if someone else mentioned it. I actually use this quite a bit in Magit. Magit is genuinely amazing. Thanks @tarsius!
- tarsius 5y agoI usually try to leave the Magit praising to others in these threads but in this case I would have found it hard to resist. Glad others have already taken care of it. ;P
- ashton314 5y agoYou've made a thing that has many loyal users, myself included. :) Will this change make your work on Magit easier? If there was something you could add/remove to/from Git to make your life easier, what would it be?
- tarsius 5y agoIt probably doesn't make much of a difference because Magit's stashing commands offer more flexibility that even after this addition is still missing from `git stash`. Stash creation is actually one of the very few areas where Magit doesn't use the respective Git procelain commands at all (as opposed to using them and then doing additional things using other pluming and/or porcelain commands as is the case in many other areas). Also I have to continue supporting older Git releases anyway; people like to use the latest Magit version without considering doing the same for Git, for some reason. Change the license to GPLv2 OR later.
- seanw444 5y ago+1. Magit is definitely the best Git client out there. It makes even non-standard functions transparent to the user.
- ndjdjd 5y agoIs this any different than soft reset then git stash
- bretthoerner 5y agoYes, --staged doesn't include unstaged changes.
- tome 5y agoPresumably it doesn't include unstaged changes in the stash.
- wiredfool 5y agoI'd love to be able to stash individual bits of a diff (from magit) to do something like bisecting on the current changes. Something like how the current `add -p` allows you to select or reject any given chunk.
- jzm2k 5y agoDoesn't git stash save -p accomplish that?
- rawling 5y ago> But what if you only want to store part of your changes in the stash? You could use git stash -p and interactively select hunks to stash or keep. It's even right in the article. (Then goes on to describe how this change means you can stash those chunks easily if you've already selectively staged them.)
- wiredfool 5y agoThe way to get a correct answer on the internet: 1) Post the wrong answer. 2) Get corrected. 3) Profit
- cdrini 5y agoCunningham's Law! "the best way to get the right answer on the internet is not to ask a question; it's to post the wrong answer."
- londons_explore 5y agoI really want those temporary commits to end up part of the finished git history, but be hidden from most views... for example, they could be called "sub commits", and tools could not show them by default unless given some extra flag. Then there could be sub-sub commits, etc to show more and more minor edits, potentially down to individual keystrokes. Throwing away the construction history of something just seems wrong in git-land. The git format already allows this - it's just the tooling and culture that needs to be adapted for it to happen.
- indentit 5y agoI feel the same, except I'd want only me (as the author/committer) to be able to see my sub-commits :D
- rapfaria 5y agoThis feeling goes away the senior you get.
- xorcist 5y agoMaybe the culture of easy to understand commits exists for a reason? Imagine someone sending in a patch for the Linux kernel, or for git itself, only it isn't only the patch but a bunch of temporary patches that in the end forms something usable. (But don't worry because a git feature will make the log skip over it!) Would you really want to review that? Would you really want it stored in the repository for all eternity? Crafting commits that are easy to understand and gives enough context to understand the change is the only way a large software repository can survive without collapsing under its own historical weight.
- skinkestek 5y agoRemoving or glossing over can always be done later. Adding back the thought process that the commits can reveal can often be hard later, even for the original author.
- 5y ago
- deleted 5y ago[deleted]