Subject: Re: git ability

From: "brian m. carlson" <[email-masked]>
Date: Sat, 13 Feb 2021 17:25:46 +0000

On 2021-02-13 at 13:25:03, PANEL Christian wrote:
> hello,
> 
> does git have the ability to handle a repository on a removable disk?

Yes, this is possible.  You should access it from only one operating
system at a time.

I also strongly recommend that if you're going to do this across
operating systems, you use UDF[0] and not NTFS, FAT, or exFAT for this
purpose.  Linux can format drives this way for use across OSes.

> here is the experience I had:
> 
> I have a project that I manage on a removable disk (therefore with a
> ".git" directory on it).
> 
> until now I did "commits" and "push" on the server from windows10.
> 
> I made changes to the source and made a "commit" from linux (on the
> same computer). Git asked me again for my username (email and user
> name): I then thought that these were not stored in the ".git"
> directory

These settings, user.name and user.email, _can_ be stored in
.git/config, but _usually_ are stored in the user's home directory,
which will differ between operating systems.  You can use the "git
config" tool to set them appropriately if you'd like.  I personally sync
my dotfiles across machines, which includes .gitconfig, which is an
approach many others use as well.

> I then saw a new branch called "linuxcompatibility" appear.
> 
> I would like to understand.

Git doesn't create branches unless requested.  It's possible that some
other tool on your system did.  For example, if you're using a file
syncing service (e.g., Dropbox or OneDrive) to sync data, that's
definitely not recommended and can cause problems like this.  If you're
using WSL instead of a true Linux system, that data could also have been
created by Windows.

It's also possible that this branch already existed on the server and it
may have shown up as a remote tracking branch with "git branch -a", in
which case attempting to check it out may have created a local copy.

Without more details or output from a program, it's hard to say what's
going on here.

> I thought to myself that I would then merge the "linuxcompatibility"
> branch to the "master" branch and push it all back to the server.
> 
> if that went well with me, on the server the branch
> "linuxcompatibility" remained.

If you want to delete a branch on the remote server, you can do this:

  git push -d origin linuxcompatibility

If you want to delete a branch locally, you can do this:

  git branch -d linuxcompatibility

[0] https://en.wikipedia.org/wiki/Universal_Disk_Format; v2.01 is
recommended.
-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US