A Great GIT modelling example
This kind of error can occur if you haven’t performed a ‘git gc’ on your local repository. If you are using a Virtual Machine (VM) and have experienced a machine reboot accidentally or did not without quit the VM properly this same problem could occur.
No you are not up the creak without a paddle, there is a way to fix your branch repository.
The following things are what you may notice;
- You cannot push to origin (bad ref/head)
- You cannot check out a specific branch (see screenshot below)
- You cannot remove ‘git rm’ or ‘git fsck’ your local repo.
The likelihood is that your remote repo is OK. The problem is your local repo. The following commands will be able to help;
Ok let’s keep this simple, here is a easy set of instructions on how to fix a Corrupted InfatedEnd or Loose Objects GIT Branch
- Open up Windows Explorer and navigate to your local repo files manually (the folder should be the folder that is the project source on your personal computer)
- Re-name that folder. DO NOT DELETE IT YET.
- If your git file path is within the application folder. ‘cd..’ to go up a level and out of the folder.
- Run the following command immediate in your git command line “git clone firstname.lastname@example.org:path”
- You should start to see the project folder being re-cloned.