Wednesday, February 3, 2016

Capstone Week 19 - Conquering Git Errors

This past weekend I participated in the Global Game Jam! It was a lot of fun, but definitely ate up a lot of time I would have otherwise spent working on Wreck-uisition. If you're interested, here's the link to our GGJ submission, and our "title" picture:

Hue-Man GGJ 2016

On to Wreck-uisition now, I finally figured out that Git repo error! As it turns out, Git has a max individual file size of 100MB. Well, the intro splash screen video we made of the game logo is about 380MB. This is what was causing the error. The real issue though was trying to diagnose and fix the issue, a window popping up saying there were issues syncing to the branch isn't very specific and not at all helpful. It's basically Git saying, "We know there's something wrong, but we don't know what's causing it."

However, the window does say to try debugging the repo in the Git shell. Now I'm relatively new to Git and source control in general so this looked like an immensely challenging task. But of course, a problem doesn't truly exist if someone hasn't posted to StackOverflow about it yet, which this one has had someone do just that. This is how I found out that the file size was the source of the issue.

Unfortunately, GitHub for Windows has some quirks. You'd think reverting a commit would get rid of the commit. No, in fact, it simply creates a new commit that overwrites the previous one with all those assets deleted. To the Git shell! The first command that proved of use was the "git status" command.

While this commit obviously doesn't show the error (I forgot to screenshot it when I actually did this), it does show you what is currently going on. My shell at the time showed me that I was 4 commits ahead of the remote master branch (due to trying to revert/commit over and over until I figured out that Gits reverting didn't actually remove a commit). So to then to actually delete a commit (since these commits meant nothing and I didn't need them at all), the command is "git reset --soft HEAD^". This deletes the last commit. The number of commits deleted is determined by the number of "^" symbols after the HEAD command. In my case I just did this 4 times since I didn't know you could add more "^" symbols at the time.

After all this, I was finally able to commit and sync with the repo properly once I had discarded the 380MB file.

No comments:

Post a Comment