Under what circumstances can files version controlled by GIT become garbled? This is my question, but here is the context: I'm learning git and have been working with a local repository, and today it looks like several of files have been corrupted (or something). All of the text looks like this: ‘Œ…fÅ�ŎÅ�õˇÅ�≤ÍÈ (for example). The files are garbled in all git snapshots since they were added. Making matters more complicated is the fact that the repo was stored in Dropbox, and was also being used to store web files for a development web server (MAMP). Any idea what happened? I haven't found anything useful on the web.
Update: now it looks like some of the files are just plain gone; For example, I get this message opening one: The alias “test.php” can’t be opened because the original item can’t be found.
Update 2: I've been thinking more about this, and I think that I've ignored a relevant detail that pertains to the general question: I moved the .git dir one directory up, i.e. in this path, Dropbox/Project/gitRepo/, the .git dir moved from gitRepo to Project. It committed without issue, but then the corruption occurred in between that event and some other git actions.
You cannot move the .git directory this way, this is bound to confuse git, because you if had committed a foo.php file, it has now become gitRepo/foo.php.
Now, if you get the .git directory back where it belongs, you can make the transition you want like this (I'm pretty sure I'm using a feature specific to the bash shell here):
Dropbox/Project/gitRepo$ mkdir gitRepo
Dropbox/Project/gitRepo$ git mv !(gitRepo) gitRepo
Dropbox/Project/gitRepo$ git ci -m "Move everything in subdir"
Dropbox/Project/gitRepo$ cd ../..
Dropbox$ mv Project/gitRepo Project2
Dropbox$ cp -r Project/* Project2/
Dropbox$ cd Project2
Dropbox/Project2$ git add .
Dropbox/Project2$ git ci -m "Import upper directory"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With