Home > Software design >  How to make repository portable between Windows and Linux (case sensitivity inside .git)?
How to make repository portable between Windows and Linux (case sensitivity inside .git)?

Time:09-28

I have a repository that I've worked on mostly on Linux. Now I want to copy it to a Windows machine. However inside .git I have two files like below (differing only in case):

.git/logs/refs/remotes/origin/xyz-1012-see-more
.git/logs/refs/remotes/origin/XYZ-1012-see-more

Is there a way to run a script on this repository to make it portable to Windows? Or am I just stuck with those two remotes because they are so on the remote server?

Thanks

CodePudding user response:

Unfortunately, there is no way to properly handle this on Windows.


On the linux side of things, you can spot the problematic branch/tag/remote branches names :

# list all ref names :
git for-each-ref --format="%(refname:short)"

# shell way to spot which names are going to yield case issues :
git for-each-ref --format="%(refname:short)" | tr '[A-Z]' '[a-z]' |\
    sort | uniq -c | awk '{ if ( $1 > 1 ) print $2; }'

(another way is to write a script in your favorite language to process the output for git for-each-ref)

Once you have spotted these, you may if you can choose a way to rename these branches/tags/remote branches ...

  • Related