Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

sync problem with file with lower case and upper case #1520

Open
knupel opened this issue Mar 13, 2019 · 13 comments
Open

sync problem with file with lower case and upper case #1520

knupel opened this issue Mar 13, 2019 · 13 comments

Comments

@knupel
Copy link

knupel commented Mar 13, 2019

Hello,
the name file is not changed when it's just type case is changed.
That can cause a trouble when we come back to old version or when other people download the file.
Or maybe I miss something to update the filename when the changement is only a upper case or lowr case.
Capture d’écran 2019-03-13 à 11 43 57
Capture d’écran 2019-03-13 à 11 45 58

@knupel
Copy link
Author

knupel commented Mar 13, 2019

Maybe more explicit:
Capture d’écran 2019-03-13 à 12 26 14

@oprogramador
Copy link

oprogramador commented Mar 13, 2019

@StanLepunK

It's not about GitHub. It's a local problem on Mac.

A workaround if you want to change the case:

  • remove all the files which case you want to change
  • git add .
  • git commit -m 'remove files'
  • for each file git checkout your-branch your-file
  • for each file mv UPPERCASE_NAME lowercase_name
  • git add .
  • git commit -m 'add files'
  • git rebase -i HEAD~2
  • for the second commit, replace pick with squash
  • write down your desired commit message

@knupel
Copy link
Author

knupel commented Mar 14, 2019

hmmm thx for the advice but i'm not really confortable with this type of operation: I figure, I must do that in the terminal to targeting the folder of my project ?

@TPS
Copy link
Collaborator

TPS commented Mar 14, 2019

@StanLepunK Did you contact GitHub support? What'd they say?

@knupel
Copy link
Author

knupel commented Mar 15, 2019

Yep I contact us, but I don't have a time now to solve it, but i do that asap. If I understand well the support say the solution of @oprogramador is not really optimum because that can erase my file history. the fix proposition is :

Hey there Stan,
Thanks for writing in and I hope you are having a great day where you are.Taking a look at that issue, as the user mentions, it looks like it might be a local issue with your repository.
Can you try, locally, running:$ git mv :old_filename :new_filename Then run $ git commit -a -m ":commit_message" By using the git mv command you are telling git to move/rename the file - and by doing so continue to track the changes. In #1520 the commenter has mentioned removing and readding the files to git, this will destroy the history of these files - which is still a valid method if that's the desired process you have.
I hope this helps and please let me know if you face any further issues with this.Thanks Matt Barber

@TPS
Copy link
Collaborator

TPS commented Mar 15, 2019

That seems very odd that @github would treat it like that.… But I suppose they're making the easy assumption. Still, the appropriate section @ Wikipedia currently says (emphasis mine)

In filesystems in Unix-like systems, filenames are usually case-sensitive (there can be separate readme.txt and Readme.txt files in the same directory). MacOS is somewhat unusual in that, by default, it uses HFS+ in a case-insensitive (so that there cannot be a readme.txt and a Readme.txt in the same directory) but case-preserving mode (so that a file created as readme.txt is shown as readme.txt and a file created as Readme.txt is shown as Readme.txt) by default. This causes some issues for developers and power users, because most other environments are case-sensitive, but many Mac Installers fail on case-sensitive file systems.

@oprogramador
Copy link

@StanLepunK @TPS

Anyway I think, it's not a GitHub issue. It's just about how git and operating systems work.

@TPS
Copy link
Collaborator

TPS commented Mar 17, 2019

@oprogramador I disagree. The git|GitHub client should preserve case, even in cases when the OS &/or filesystem don't. Since MacOS does, I don't understand the above behavior @ all.

@user4i
Copy link

user4i commented Jan 2, 2020

📌📌📌
If you need to commit files renaming, just capitalization, and you have a problems with staging/commiting, as option

  1. Change capitalization of "file" name and add "1" to the end (or other symbol)
  2. Stage (without commit) = result "File1" - renaming files
  3. Remove "1" from the end
  4. Stage (without commit) = result "File" - renaming files (only capitalization now)
  5. Do commit.

Update March 2021: These steps are more useful to apply in visual code editor like vscode or visual git tool. For command line see Option 2 proposed by @coolzoom in #1520 (comment)

@knupel
Copy link
Author

knupel commented Jan 5, 2020

thanks for the tip

Osmiogrzesznik added a commit to Osmiogrzesznik/js-wedding-planners that referenced this issue Mar 15, 2020
Osmiogrzesznik added a commit to Osmiogrzesznik/js-wedding-planners that referenced this issue Mar 15, 2020
Osmiogrzesznik added a commit to Osmiogrzesznik/js-wedding-planners that referenced this issue Mar 15, 2020
@ivnlabs
Copy link

ivnlabs commented Mar 11, 2021

📌📌📌
If you need to commit files renaming, just capitalization, and you have a problems with staging/commiting, as option

  1. Change capitalization and add "1" to the end (or other symbol)
  2. Stage (without commit) = result "R" - renaming that files
  3. Remove "1" from the end
  4. Stage (without commit) = result "R" - renaming that files (only capitalization now)
  5. Do commit.

THANKS THIS DO THE JOB DONE

@coolzoom
Copy link

coolzoom commented Mar 31, 2021

📌📌📌
If you need to commit files renaming, just capitalization, and you have a problems with staging/commiting, as option

  1. Change capitalization and add "1" to the end (or other symbol)
  2. Stage (without commit) = result "R" - renaming that files
  3. Remove "1" from the end
  4. Stage (without commit) = result "R" - renaming that files (only capitalization now)
  5. Do commit.

Epic tips! Thanks.
also, I found no need stage if you use git mv to rename.
for anyone who wishes to try, below are the examples of renaming a folder.

Option 1 example based on @user4i :

mv Folder folder1
git stage .
mv folder1 folder
git stage .
git add .
git commit -a -m ":commit_message"

Option 2 example based on #1520 (comment)

git mv -f Folder folder1
git mv -f folder1 folder
git add .
git commit -a -m ":commit_message"

@user4i
Copy link

user4i commented Mar 31, 2021

also, I found no need stage if you use git mv to rename.
for anyone who wishes to try, below are the examples of renaming a folder.

Good idea! But stage is more convenient and quick to apply these steps #1520 (comment) in visual code editor like vscode or visual git tool. Additionally Option 2 was not so easy to apply, may be because of my OS/git settings.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants