Prevent switching branches when local modifications exist

From: Christoph Bartoschek <hidden>
Date: 2016-06-15 22:54:04

Hi,

how can I prevent that git allows me to switch branches when there are 
uncommited local modifications?

[14.1 (steiner_topo)]$ git checkout -b ergo
Switched to a new branch 'ergo'
[14.1 (ergo)]$ echo blub >> src/invtree.C
[14.1 (ergo)]$ git checkout steiner_topo
M       src/invtree.C
Switched to branch 'steiner_topo'
[14.1 (steiner_topo)]$ 

How can the last checkout be prevented?

-- 
Christoph Bartoschek
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help