Michael
Michael

Reputation: 909

Can I share a git folder between dual boot instances?

I dual boot (Windows/Ubuntu) on my laptop and I have a few git repos that I might work on from either.

Previously I would have had separate folders for each boot and used the traditional push/pull approach when working from each.

Is it possible (safe/stable) to have a single working folder and access it from both boots, and if so would I need to ensure I committed before switching?

Does it make a difference if I use an IDE (say Eclipse)?

Upvotes: 1

Views: 418

Answers (1)

Schwern
Schwern

Reputation: 164709

There's only two concerns: the Git version and line endings.

Git version

The internal structure of a Git repository has changed some over the years. Using two different Git clients to work on the same clone might be a problem if they're very different versions. Best to be sure you're using a close to the same versions as possible in both Ubuntu and Windows.

Line endings

This will be the biggest issue. If your Windows editor is using crlf and your Ubuntu is using lf things might get confused. This is a normal problem for working with a Git project on many platforms.

A simple fix is to add EditorConfig to your project. This consists of putting an .editorconfig file at the top of your project and choosing a canonical line ending. For example...

# Unix-style newlines for every file
[*]
end_of_line = lf

Many editors recognize EditorConfig. Others need a plugin.

This avoids yourself or anyone else having to worry about configuring their editor for your project, your EditorConfig will take care of it. It can also cover character sets, indentation, tabs-vs-spaces, final newlines, trailing whitespace... all those fiddly little whitespace issues that plague projects.

Upvotes: 2

Related Questions