News for hackers. Stuff that matters.
Re:Lesser known Git commands by dahart on Friday September 30, 2016 @04:40PM (#12615157)
Brilliant! I wonder why git stash wasn't implemented similarly in the first place.
Re:Lesser known Git commands by derefr on Friday September 30, 2016 @05:16PM (#12615333)
My hypothesis: git was implemented assuming that—at least for large projects—you would have a local on-disk bare clone of the repo, and then multiple workdir checkouts of that bare clone sitting on different branches. The setup with a single clone containing a workdir with a .git dir inside it is a hack that's nice for "on-the-go" use-cases, but wasn't intended for serious developers contributing many changes to the same codebase.

git-stash, then, is only for the use-cases that are not better solved by just leaving your WIP workdir as it is and checking out another, concurrent workdir for your new feature. Such as, for example, taking code you were accidentally writing on one branch, and "shifting it over" onto some other branch; or "moving your changes out of the way" to run some tool that is broken by them, then putting them back in place, because you really still are working on them.

Re:Lesser known Git commands by Too on Saturday October 01, 2016 @04:26AM (#12617028)
This is how you have to deal with branching in almost every scm. Changing branch might require you to rebuild something slow and then it's good to have multiple working directories. If you have monorepos you might also want to test component a on branch x vs component b on branch y etc.

If you are only working serially then switching branch in one working dir is obviously easier and to be preferred but some times you really need multiple checkouts of the same repo.

Re:Lesser known Git commands by Asooka on Friday September 30, 2016 @07:02PM (#12615748)
Er... but then you have (N+1) checkouts of the repository where N is the number of workdirs, no? How does this even work with submodules? Will I have a copy of the submodules tree in each workdir? Our submodules tree is like 4Gb at this point, I can't very well have 5 of them. Disks are large, but not yet infinite.
Re:Lesser known Git commands by derefr on Friday September 30, 2016 @07:05PM (#12615759)
Directory hard-links?