How to restore version control in XCode?

I have just recently backed-up my XCode C++ project on my pendrive, using

rsync -avu 

Since then, the version control for my project is grayed-out on every files, I can modify the files and not see the “M” nor the “A” sign. The only files still having version-control working “shared” files for which it works correctly. (Those shared files belong to a different project called “Shared”).

I have tried git commit -m, git add . and even git init where the files were. Nothing worked.

Can you please help restoring version control for my project?


UPDATE:

Answers for the questions in commens (and answers):

  1. my git repository is on my local hard drive.
  2. I went to the Organiser-repository pane in XCode and I see my recent git commit -m "sth" as “sth” az a commit. I have a single branch: master.
  3. Im not sure what command would be good to test git, as my commits work (theoretically).
  4. I have a folder named .git in the project folder.
  5. git log is working, showing the same as XCode Organiser-repository pane.

I think the XCode just can’t synchronise with the git for some reason, and I don’t know how to correct that.

  • What is the purpose and function of Xcode's source control “Show Remote Status” menu option?
  • Xcode 4.5 - Can't create Branches/Trunks/Tags for SVN
  • UserInterfaceState.xcuserstate not getting committed while using git in Xcode
  • xCode 4.5 git merge fails to commit or give errors
  • Still do not understand how to recover and perform a “git reset HEAD”
  • Did Apple remove the 'git gui' command in XCode 4.5 command line tools?
  • Can't exclude user interface state from commit in xcode
  • One Solution collect form web for “How to restore version control in XCode?”

    First off, this is not an answer that will fix your problem, I just try to provide some help that might get you closer to a diagnosis.

    Git stores its files in a folder named .git. Check if this folder is present in your project. If it’s not then your Git repository is gone.

    Next, try some basic command such as git log. For this to work, you must first cd to your project folder (or a subfolder thereof), because whenever you run a Git command it will look for the .git folder in the cwd or a parent folder. If git log does not work then your Git repository is broken in some way. Someone else will have to step in to further diagnose the problem, as I am no expert on this subject.

    Finally, you should also check whether your rsync command has really sync’ed your project’s .git folder with the backup’s .git folder. Use this command:

    diff -rq /path/to/project/.git /path/to/backup/.git
    

    If there is no difference (as I would expect if rsync has worked correctly) then the problem with your Git repository is both in your project and in your backup. If there are differences then it might be worthwile to try your next steps on a copy of the backup (it should be fine to make the copy in the Finder).

    Good luck.

    Git Baby is a git and github fan, let's start git clone.