2 ms·
You're showing the stashing part, but disregarding what happens when you get back to the original work. You now have to either git reset or git ammend or git sq
by tsimionescu 6y ago
You're showing the stashing part, but disregarding what happens when you get back to the original work. You now have to either git reset or git ammend or git squash later and so on. Oh, and if you want to edit the commit PRIOR to the WIP one, you need to do several of these, simce only the latest commit can be eaisly edited.
And the alternative in something like P4?
cd ../other-branch
# do some work
cd ../first-branch
Vs the git solution:
git commit -a -m WIP
git checkout other_branch
# hopefully you didn't have any untracked files that you meant to add on both branches
#do some work
git checkout first_branch
git reset -s first_branch~1
Sure, it's not THAT hard, but it's still much harder than it needs to be, it's harder to learn, easier to mess up and takes far more time (git checkout is not an instantaneous operation, unlike cd). Not to mention, there are at least 4 ways to do this, with slightly different trade-offs, further increasing the mental load.
Edit: oh, and let's not forget that sometimes you want to actually compile and run and debug two different versionsof your product, and then the git model completely breaks down.