Take the 2-minute tour ×

If I run git status:

# On branch new-media
# Changes not staged for commit:
#   modified:   .gitignore
#   modified:   app/views/layouts/application.html.erb

Then I checkout the master: with git checkout master

M   .gitignore
M   app/views/layouts/application.html.erb
Switched to branch 'master'

Previously, git stopped me from checkout other branches, prompting me to either stash or commit the changes I've made on the current one. Now, it no longer does so.

share|improve this question
I'm sure it never did behave that way. This behavior is intentional. Could it be you are confusing this with changes that have been added to the index and switching branches? –  pmr Jul 13 '12 at 18:55
add comment

3 Answers

up vote 4 down vote accepted

Git switches branches with a dirty working directory just fine if the changed files are the same on both branches. If not, it will stop you. You can override this behavior with the -m flag.


share|improve this answer
add comment

It only prevents you from switching branches with uncommitted changes when those changes conflict with files in the other branch. If Git can switch cleanly, it will do so without prompting you.

share|improve this answer
add comment

It should prevent the branch checkout (prompting for a stash or commit) if there had been another change to those same files on the branch that you were attempting to check out. But if there were no differences between branches to those files, then it should always allow the checkout.

I agree with pmr, you're seeing the "normal" behavior now, and have seen the "conflict" behavior before.

share|improve this answer
add comment

Your Answer


