This is my first question, and I tried to search the forum and google for answers but am hitting a block.
So I'm saving my git files on Google Drive. After creating 5 commits, I get the output as below from the git log --oneline
5c1bd8f (HEAD -> master) 5th commit - robots.txt
ca656ac 4th commit - robots.txt
3850e6c 3rd commit - robots.txt
bd5b39f 2nd commit - robots.txt
6f3ee36 1st commit - robots.txt
a177016 All files committed
I then proceed to create a new branch by switching to the 2nd commit by typing git checkout bd5b39f.
However, when I want to go back to master, by typing git checkout master, I get the below output.
$ git checkout master
fatal: bad object refs/desktop.ini
I have googled it up and found this solution: Git / Google Drive Bad References
Cleanup was fairly simple once I realised what was going on:
- Pause Google Drive to prevent further interference.
- Delete all the hidden desktop.ini files in the repository. I did this via a command-line window, but it should be possible via Windows Explorer with the right options.
- Compress the Git database.
- Resume Google Drive.
I have tried to delete the desktop.ini file using Windows Explorer and also the command line, only to come up with this output.
$ git checkout master
fatal: bad object refs/desktop.ini
D desktop.ini
I did not understand Step 3 - Compress the Git Database.
I also checked out this link from stackoverflow which was similar but not the same: Fatal Bad Objects
$ git gc
error: bad ref for .git/logs/refs/heads/desktop.ini
error: bad ref for .git/logs/refs/desktop.ini
fatal: bad object refs/desktop.ini
fatal: failed to run repack
Would appreciate any help provided.