News for hackers. Stuff that matters.
Re:Key Git Concepts Explained the Hard Way by merlincorey on Wednesday March 14, 2018 @08:07PM (#16589484)
> in git, for example, why can’t i switch branches with uncommitted changes? it makes no sense why i can’t do that, but yet, there it is.

Because the working tree having uncommitted changes being blown away would be terrible data loss or a conflicting merge, so when that could happen, git prevents it.

Use `git stash` to stash your uncommitted changes before switching branches and you'll no longer have data loss.

If you want to apply those changes again use `git stash pop`.

If you don't want those changes use `git stash drop`.

Why isn't there a commandline option to checkout a branch and do a stash operation at the same time?

Because no one has needed it enough to add it.

Re:Key Git Concepts Explained the Hard Way by coldacid on Wednesday March 14, 2018 @08:16PM (#16589533)
>Because no one has needed it enough to add it.

Or because those that did need it whipped up a quick and dirty alias to cover that use case.

Re:Key Git Concepts Explained the Hard Way by chopin on Thursday March 15, 2018 @03:21AM (#16590983)
I wouldn't want this. This would only be useful if the stash is automatically popped when switching back.
Re:Key Git Concepts Explained the Hard Way by chrismcb on Thursday March 15, 2018 @10:32AM (#16593145)
I think the implication is that switching branches shouldn't blow away your uncommitted changes. And one shouldn't have to stash their changes to switch branches.