In programming, a spike a place to test out various methods before actually coding the finished project. For the past week, I’ve been practicing with a whole host of components that I will ultimately use in my final project such as modals, lists, animation, React components, JSON data, states, props…the list goes on and on and on. I didn’t want to lose this code because, believe it or not, it can actually be really helpful down the road. Sometime I’ll forget how I did something originally, and I’ll have to refer back to the previous file. To solve this issue, I created a Spike branch in Github.

I essentially backed up my spike so that I could reference it later on. To be honest, I’m not entirely sure what I did, but my mentor told me that I was backing up my code so I’ll take his word for it. Originally, my spike was in my Master branch. I used this code in terminal to back it up:

Here is a useful article about creating GitHub branches logically and neatly. It covers the importance of creating a good branch structure, especially when dealing with continuous development. Here is a cheat sheet:

Hope this helps! It’s a good way of storing your work so that you can reference it later. You might also want to store a local version of the spike by downloading the zip file just in case.

Update July 4, 2017 Here’s a good way of untracking files (espeically those with sensitive information): $ git update-index --assume-unchanged <file>. This command simply stops tracking, it does not delete it so make sure there is no sensitive information before you add it to the repo. Use a placeholder like “API_KEY”. To rever this, use $ git update-index --no-assume-unchanged <file>. To get a list of all files that are assumed-unchanged, use: $ git ls-files -v|grep '^h'.

Posted in General Programming with GitHub, Terminal, Unix