From zero to code hero

Just another page about javaScript, me, cats and general programming things.

Better tutorials thanks to git

Some time ago I attended a react training with React University. And I learned a pretty sweet trick that makes following code changes really easy.

Demo that Freddy prepared for the training had a bunch of git tags for every major step. It looks something like this :

$ git tag
00_initial_stage  
01_simplifying_arrow_functions  
02_supplying_initial_state  
03_persisting_state_in_local_storage  
04_refactoring_entry_point  
05_adding_react_router  

I knew about git tag before, but I never thought about using it to compare stages of repo. Now having tags, you can easily check what are the differences between your repository at two tags:

diff

using git diff:

git diff <tag1> <tag2>  

Pretty sweet, huh ? Other great thing about it, is that you can quickly fast forward to the stage at tag using git checkout if you'll have trouble following the training or tutorial:

git checkout -b 02_supplying_initial_state