Vc'd files with git distorted

Under what circumstances is the version of files managed with GIT distorted ? This is my question, but here is the context: I study GIT and work with a local repository, and today it looks like several files were damaged (or something else). All text looks as follows: ‘Œ…fŠŎŠõˇÅ ≤ÍÈ(for example). Files have been distorted in all GIT snapshots since they were added. To make matters worse, the repo was stored in Dropbox and was also used to store web files for the development web server (MAMP). Any idea what happened? I did not find anything useful on the Internet.

Update: now it looks like some files just disappeared; 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 thought about it more, and I think I ignored the important detail related to the general question: I moved the .git dir directory alone, that is, along this path, the Dropbox/Project/gitRepo/.git file moved from gitRepo to Project. He committed without problems, but then there was corruption between this event and some other GIT actions.

+3
source share
1 answer

You cannot move the .git directory this way, this should confuse git, because if you moved the file foo.php, now it would become gitRepo / foo.php.

Now, if you return the .git directory to where it belongs, you can make the transition that you need (I'm sure I will use a function 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"
+1
source

All Articles