0

I am working on a project for long now and i have changed many files so far.

When I tried to commit the changes in git using -

git commit -a -m "my message"

It is saying that my index file is to small for commit.

Is there a way to get back all my commits back to index file and commit my changes without recloning the branch and replace all the file I change.?

Jithin Raj P R
  • 6,667
  • 8
  • 38
  • 69
  • Your system may be corrupted: https://stackoverflow.com/questions/15780627/git-error-index-file-is-too-small – Tim Biegeleisen Oct 10 '17 at 05:16
  • @TimBiegeleisen am using MacOs Sierra 10.12.6 and that is not the error am getting, and other repositories am working on my PC is working fine, and this branch is working fine on other PC's fine. – Jithin Raj P R Oct 10 '17 at 05:22
  • Um...it looks like the same error message to me. As a Git user of nearly 7 years, I don't think I have ever seen this error. Maybe follow the advice in the link above to fix it. – Tim Biegeleisen Oct 10 '17 at 05:24
  • Quote the *exact* error message (cut and paste from the Terminal window). – torek Oct 10 '17 at 06:37

1 Answers1

1

It looks like your repo is corrupted. If you need to get back to a safe state, you should clone it again somewhere, and also save your files.

If your tar version is decently recent, save your files excluding the .git folder, with:

cd <root folder of the repo>
tar cf ~/backup.tar --exclude .git .  # dont forget the '.'

then get a new clone of your repo, if its history is relevant for you

git clone oldMirror.git newRepo
cd newRepo

and then restore your files as they are:

tar xf ~/backup.tar

then you should be ready for performing the command that failed before:

git commit -a -m "my message"
carnicer
  • 494
  • 3
  • 9