DEV Community

Matthew Hassenboehler
Matthew Hassenboehler

Posted on

Unlocking Git's Power: A student's first encounter

What is Git? To most developers Git is a daily tool used in the workplace, but to budding students and self-taught beginners it is a step into a whole new world. A world that one should become familiar with else they may find themselves in a difficult position when the time comes to start typing in that terminal. However, I am not typing this today to chastise anyone but to give those who are unfamiliar a follow noobie's learning experience and takeaway and maybe also those devs who are much further along their path as a coder and wish to seek insight on a fresh mind.

- The Power of Version Control

Version Control is the act of keeping up with your software code throughout it's changes. They are tools that devs normally use to maintain any changes to the source code. Here is an example of the basic workflow of version control using Git.

Say we have a file named script.js that has a list of games I like. Upon changing said file and wanting to keep it updated I could do the following in the terminal:

git add script.js 
// Stages our file for commit
git commit -m "our comment here" 
// This commits our file and leaves a comment with it
Enter fullscreen mode Exit fullscreen mode

If we did not have access to software tools such as these, I'm sure working would be a lot more difficult and troublesome especially in the workplace, where leads to my next point..

- The Incredible Accessibility of Git

Using Git these past two weeks has opened my eyes to how interacting in a workplace can potentially be. Git has the ability for us to all work off the same repository with very little difficulty using push and pull commands. This is an amazing feature that allows not only a group in the workplace to work on a single project but also allows someone to work in different places need be. A group also has the ability to all work on separate parts of a project and then merge it all back together. For example say you started a project but your partner has already been working on it, here's how we would update our end of the repository:

// First let's get our project
git clone [project.url]
// Now since we have a partner who's ahead, let's create a remote that looks at their version
git remote add partner [partner's forked project url]
// now to get ours up to date, we pull from that remote
git pull partner main
Enter fullscreen mode Exit fullscreen mode

At this point our project.js should be updated to the point of our partner's saved version.

In conclusion, I think Git is an amazing tool that the sooner you become accustomed to it the better. It brings tons to the table and you'll probably find yourself using it if you work with sites like Github(shocking I know). I hope you found this read enjoyable and Git what the fuss is all about.

Top comments (0)