Re:Lesser known Git commands
by ashark on Friday September 30, 2016 @11:48AM
(#12613167)
My #1 use of stash is as the quickest way to express "get rid of all this crap". I rarely intend to ever retrieve it.
[ Parent
| on HN ]
Now here's one I actually like. As an alternative to git reset, a git stash is safer, and gives you an easier way than reflog to recover if you dropped a commit you want back.
For one of my projects, the 'build process' requires that I use the git archive command (basically archive to .tar.gz without any git-related files/directories). git archive on its own is fine for final builds because it's based off of HEAD for the current branch, but if I want to test a build with working changes, I would either need to commit all the changes _or_ use git stash and then archive based on the state I just stashed.
So in this case git stash works a lot better for a 'temporary' commit, kind of deal.
It might not be optimal but I've found the process to work pretty well for this particular project's situation.
Re:Lesser known Git commands
by ianleeclark on Friday September 30, 2016 @11:56AM
(#12613227)
git checkout -- .
Also works well for this use case
'git reset'.