error: Your local changes to '.gitignore' would be overwritten by merge. Aborting. Please, commit your changes or stash them before you can merge.

C++
//If you don't care about your local changes, 
//you can switch to other branch temporary (with force), 
//and switch it back, e.g. :
git checkout master -fgit status
git stash
git statusgit stash

Source

Also in C++: