As a beginner programmer, has it ever occurred to you that you mess everything on your working code and now you don’t know what to do about it? Also since these changes were made on different durations, you can’t just ctrl z to the previous working version.
I recently had to go through this. I was working on a new blog project on my localhost. Everything was working fine until I tried adding some ads to the blog and everything got messed up. I added codes from different sources to different files in a duration of one week but nothing worked to show ads on my blog rather it broke my site.
Then I had to remove all those codes one by one so that I could revert it back to working condition. Another one week of work.
It’s not that I hadn’t heard about Git. But I never bothered to learn and use it.
For someone who is not familiar to Git, Git is a distributed version control system meaning you can manage different versions of your app with Git. No matter how big or small your project is, Git can be very helpful to every programmer. Now let’s hear the joy of learning Git.
When this issue occurred to me, I went through some tutorials on YouTube, read some blog posts, and particularly this post on Microsoft docs to learn about git.
First I learned about the basic git commands. It helped me learn about the basics of version control. I was amazed to see that two simple commands could let me save my work in a commit which is a snapshot of all the files at that point in time. If I mess everything up in the newer versions then I could revert back to a working snapshot (or commit).
Also, I didn’t have to care to mess with my code by using branches. A branch would make the exact same copy of my main code and I could work on it without having to change my main code. When the changes are correct, then I could merge it into my main code(or master branch).
Had I known about just these basics, I wouldn’t have spent a whole week trying to debug my blog.
From my own experience, here are some of the points on why you must start using Git and Github.
By this point, you must have realized why it is necessary to have version control on your coding project.
It is not always possible to use google drive to save your code every time you make some changes. With git, you can save each and every change no matter how many times you make changes to it.
Even if you have to revert to 6 months back in your project, git makes it easier for you.
If you are a beginner programmer, it may seem cool and at the same time daunting to use a command-line interface. But having to go through this on my own as a beginner level programmer, let me tell you that it is way easier to learn Git than you may think.
You can get started with Git in just 5 minutes. All you have to do is install git and configure simple things to get started. Also, you can set up a free account on GitHub to create remote repositories and push your code from your local computer to GitHub.
Let me tell you one of my other experiences with you before I start talking about it.
Have you ever been so dumb that you asked your friend to send codes via email or a link to a Pastebin so that you could run it on your computer and make changes to it? Well, I was!
But with GitHub, you can just fork someone’s code (which makes a copy of their code in your GitHub account) and make changes to it and make a pull request to merge it to their repositories so that the changes are reflected on their repositories as well.
Learning this also helped me to learn to contribute to open source projects as well.
I got to know about HacktoberFest which is basically a month-long event where you could contribute to open source and get a chance to win prizes.
This was the best time to contribute to some Open-Source projects for me.
You can basically find Open source projects on GitHub and make some contributions to them.
Also with GitHub, you can save to code to remote repositories and access your code from anywhere. You can also show your code and coding activity to others with GitHub.
If you do some programming or thinking of getting into it and not using Git and Github, then I have only one thing to say to you.
Yesterday was the best time to learn Git, Today is the next best time.
I read it somewhere and now I don’t remember it.
Now that I know some basics of git and GitHub, I have been using them to save different versions of my code no matter even if it is a simple code for assignement.
Also I have been using GitHub to manage versions for this blog. I would say it has actually made my life easier to work with code.
There are many free resources you can learn about Git and GitHub for free. You can head over to YouTube and search for tutorials related to git for beginners and learn about the basics. Next start using Git and GitHub for each of your projects. The only way of learning Git the proper way is by using it.
Also, Git has a complete book on learning git. You can access the book here.
- GitHub Student Developer Pack: Get Access to premium developer tools and services for free
- LinkedIn Learning For free
I hope this simple article will motivate you to start learning Git.
If you have any experiences, don’t forget to share them in the comments below.