I'm having a hard time understanding some git/DCVS concepts. Here's what happened:
- I created a git project, and imported it from an SVN repo
- I made some commits
- I wanted to experiment something, so I created a branch called constants-update
- I switched to constants-updatebranch, moved some files, deleted others and added many more
- I committed to this branch
- Now I'm trying to switch to my master branch using
git checkout master
- I got this error: error: You have local changes to 'src/groovy/Constants.groovy'; cannot switch branches.
My understanding of DCVS is that I can switch branches at will, even if some branch has more or less files than the others, as long as I commit my files. I've tried committing with git commit -a
and switching to master branch, but I have the same error.
As a side note, when I commit git warns me that LF will be replaced by CRLF and warns me about some trailing whitespaces also; after I commit I do a git status
and a bunch of files always appear as #modified ...
.
Is this related to git/windows, or I do not understand correctly what it is supposed to happen? I just want to switch to my master branch without losing my changes in the other branch.