Skill Up – Git

Earlier this week I finished the core mechanic of my Dungeon Explorer game, so I stopped for the night. The next day I started right in on my first supporting mechanic and about two hours later I realized I had not changed my branch. I’ve only used git for the last few months and only as a solo developer, so my skilling up has been slow.

So here I had a problem, I wanted to merge my old branch, QuestArea onto master and then create a new branch QuestBoard. I remembered reading about stash and had toyed with it briefly many months ago. Well now I had a chance to use it for real.

I read the documentation for stash and figured it would be easy peasy. Ha! If I only had modified files I would have been done quickly, however, I had new files and I had missed the --include-untracked option, followed a stackoverflow answer that said to use --all instead. Well --all grabs everything including the ignored files. I only needed to stash a handful of files, yet I managed to stash hundreds of them. D’oh!

Well, I stayed calm as I still had not lost anything. I finally figured out that if I staged the files then git tracks them and stash stores them. Then once I got them stashed, I did merged QuestArea onto master and pushed to origin. From there I started my new branch, QuestBoard, and popped the stash back out. A quick commit made sure I had everything. Then I dropped the other stashes I had made and carried on smartly.

I believe there are many different ways I could have done that. How would you fix a mistake similar to this?

1 Comment »

Send a Missive

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.