Hi there. Today is day 9 of my 74 day challenge to become a Unity game developer!
Sooo, I finished the game for the most part! The tutorials are done and now as a challenge I get to add some additional functionality and really make it my own, which I am super excited to do. You know what else I did? I accidentally pushed an outdated version of my project to github which then reverted my local branch back to where it was yesterday, essentially erasing all the work that I did today. FUN. Git issues are almost like a right of passage aren’t they? I’m honestly relieved that I’m getting some experience with it now while I’m learning on my own rather than having to go through this while working on a team. After over an hour on the phone with a tech lead in the program (who has the patience of an angel) we decided it’s probably best to just start from scratch with a new repository. I have resigned myself from it for the evening and will try to recover my files with fresh eyes, a full stomach and a functional brain in the morning. With that said, I’m going to hold off on explaining the progress of my game until tomorrow.
Some things that I learned from this GIT experience are:
- Check status often. The git status command allows you to see the state of your working directory and to know which changes have or have not been staged.
- It’s good to make sure that your .gitignore is formatted properly and to add anything in there that you do not want added to your repo. In this case there was a large file that was the causing an error when trying to push to the main branch. The .gitignore allowed me to still save it in the project folder without me having to worry about it causing an error anymore.
- Make a copy! Seems simple but I almost didn’t do this.
- Use the reflog. The git reflog shows each commit that modified the git repository. When I was trying to figure out what happened it was helpful to be able to see all the commits and to have a way to reference them if I wanted to revert back to a previous state.
Hopefully it won’t take too long to get my files restored because once I get it up and running it will be an exciting day. I wasn’t expecting to be able to add things to the game as part of the course. It was something that I wanted to do but didn’t think I’d have the time to so I’m pretty pumped to give it a shot. I also want to take time tomorrow to really comb through everything I’ve learned this far and make sure I’ve grasped it all.
See you then.