git – dual boot ubuntu and windows with separate data partition
Everything is committed in windows 7’s git, but in ubuntu’s git, running
git status shows everything as modified. When I tried
git log all the history is still there.
- Run git server on local network
- How to adjust SVN settings to convert line endlings on Windows?
- Git post-update hook cannot pull
- Smartgit - cannot connect to repository while on a MAC
- How can I debug .gitignore file handling?
- How are environment variables used in Jenkins with Windows Batch Command?
I don’t want to commit everything every time I switch to the other OS to work. Is there a solution?
3 Solutions collect form web for “git – dual boot ubuntu and windows with separate data partition”
Your problem is that when you check out files on Windows with the git default config, they are created with
CRLF (the windows default) line endings in your working directory, but committed as
LF for cross-platform compatibility.
Now your Linux sees the
CRLF on every line and says that it’s different to the
LF in the repo. That’s why every line is reported as different.
I would suggest setting the line endings to
LF on windows. In a previous answer I explained the details of how to do that. Following those steps will also enable line-ending normalization to
LF on linux, which will avoid problems if you accidentally create some
CRLF on windows and commit that in linux later on.
You can also just disable line ending normalization completely, but that is likely to cause trouble in the future, unless you only use a completely fixed set of editors, whose line ending handling you know very will.
The problem is that the newline convention on Windows differs from Linux, and so on the Ubuntu side every file looks like it’s been modified in its entirety (with the addition of a CR right before the end of each line). This usually happens because the repo is checked out with some level of
autocrlf: in the repo, the files have the LF convention, but when checked out on Windows, the files have CRLF line endings.
If you want to safely share your working copy with Windows and Linux, you should just turn off
I’m guessing there’s an issue with line endings. You probably have commited your code with windows line endings and when you checked out the code in ubuntu git converted those to unix style line endings.
Take a look at this page Dealing with line endings