Git Gud

Sean Prashad
Open Source @ Seneca
3 min readDec 21, 2017

--

Version control is an essential part of any developers toolkit and as such, being proficient with systems like Git makes your life much easier. Not only does it manage multiple snapshots of your source files, but it makes collaboration — an underlying trait of any Open Source project — possible via websites like GitHub.

Our lab this week had us creating a simple library of functions that working with file metrics such as calculating the SHA1 or MD5 hash digest, the file size in bytes or the parsed file name for a given file. While I could have chosen to complete this library in a language that I was comfortable with, say C#, I thought to myself:

"The Open Source mindset isn't to avoid new things, it's to get involved with them!"

And so I sought out to use a language that I've never used before - Rust.

After browsing Rust documentation and completing a simple “Hello Worldexample, I was confident with my 15 minutes of knowledge (really I was!). Luckily, my google game is strong and it only took me a handful of hours to search and debug to get all of the library functions written. It wasn’t that syntax was a huge issue but rather the fact that Rust returns these things known as a “Results” which stumped me for quite some time. Luckily, I had #rust-beginners on Mozilla’s IRC server to bounce some questions off of to get me on the right track!

I was able to make my life easier but finding code snippets on GitHub that mimicked what I needed to accomplish for my library. Searching for phrases like “How to calculate a file’s size in Rust?” lead me in the right direction early on

After completing my library, we were tasked with contributing to another student’s library (another file processing library like my own) and I was on the lookout for a second new language to work with. After some searching, I managed to find an open issue on a fellow classmate’s repo, found here.

Michael’s library was written in Python, a language that I’ve seen but never touched so I said “How hard could it be to learn some Python?” Low and behold, there was an existing Python function that calculates a file’s size. With some help from examples off StackOverflow, I had written the function in a mere 30 minutes:

My first few lines in Python!

I forgot to mention that I had been using Git throughout this whole process, both for my own library and the one that I contributed to. I had struggled with merging in the past (probably because I’ve always worked in a solo environment with Git) so I made sure to follow the procedures that our Professor had outlined for us, found here.

I encourage you to check out the instructions up above — it encourages a systematic way of doing things — just how I personally work.

Overall this was a great lab that pushed us to move further outside our comfort zone. It was also a pleasant opportunity to learn Git in an interactive setting and engrained upon us a good pattern to follow for future work.

--

--