In this article, I won’t discuss how to create a GitHub account or how to make use of the terminal to make a Git commit. however, I will discuss why using Git and GitHub every day is so important, especially for those of you who are learning to code. I’ll discuss the three simple and basic rules that you can easily follow to become a master Git and GitHub user.
Why are Git and GitHub so important?
If you are looking for learning to code, the most important goal is to eventually get a job as a software developer. In that case, the answer is very simple:
Majority of the companies that can hire you will use Git and GitHub so Learning Git and GitHub is incredibly important . if you use or know how to work with Git and GitHub then it will make you more hirable and help you differentiate yourself from more junior developers.
What is the post of senior developers defines, senior is not that they know the syntax of a particular language better than anyone, Instead they have experience of working with major and complex projects with real users and business goals.
When you are learning to code, it’s hard to get that kind of experience. However, a simple way of getting real-world experience is by using the tools and methodologies used in real-world projects. Git and GitHub are an example of those.
Other things you can do are remote pair programming, contributing to open source, and building professionally-designed websites for your portfolio.
Even if you agree that mastering Github and Git will help you to get a job, you might still be wonder:
“Why are Github and Git is so important for companies?” let’s discuss
The answer is that Github will gives the access to you in teams to efficiently and effectively contribute code to the same project in an asynchronous way. This will empowers teams to collaborate for better experience and thus allows them to solve major and more complex problems.
Git, which is a distributed version and control system, also provides mechanisms to revert changes, it will create branches of code, solve merging conflicts, and so on. Those are very essential features that can solve specific and common problems where every software team faces every day. And Git is the dominant solution for us.
Where GitHub, on the other hand, is an additional layer on top of Git which provides solutions to other specific and common problems which we face such as code reviews, pull requests, bug tracking, and so on.
why it’s so important to master in Git and Github for that there are three simple rules we have to follow these rules and become a professional Github and Git user.
3 Rules are as follows:
- We have to Create a Git repository for every new project
- Then we have to create a new branch for every new feature
- Use Pull Requests command to merge code to Master
Even if we have to work on small and simple projects, by following these basic rules every time you code will make you a Git and GitHub master user very quickly.
Let’s briefly break down each one of the rules so you understand what you are supposed to do and why each rule is important.
Rule #1: Create a Git repository for every new project
This first rule is quite straightforward, but making a habit out of it is very important. Every time you start working on something new — your portfolio, a learning project, a solution to a coding challenge, and so on — you should create a new Git repository and push it to GitHub.
Having a dedicated repository is the initial step to being able to use version control for each and every line of code we write. Using version control is how you will work once you move to corporate society you have to start working on industry projects.
Quick Note: if you are using the terminal and it may becomes a hassle that makes you less likely to use Git for all projects, consider using the Github Desktop app.
Rule #2: Then we have to create a new branch for every new feature
Let’s say if you are working on portfolio and want to build a new “Contact me” component. Then Create a dedicated branch for new feature, we have to give it a meaningful name (e.g. contact-me-section-new), and then commit all the code for specific branch.
If you don’t know about the branches and what branches are, then go back to the Github Flow reading that I will recommended before.
Working with different branches will allows you and yours team members to work on various features in a parallel way while keeping the code for each feature isolated from the rest. This makes it difficult for unstable code to get merged and to the main code base.
Even if you are the person in your team, getting used for feature branches will make the Github Flow process a breeze once you join a work on project.
Rule #3: Use Pull Requests command to merge code to Master
Repository will always starts with a master branch and it is by default. One should never push changes directly to the master branch. Instead, we should use feature branches, and open a new Pull Request to merge the feature branch code with the master branch code.
In a industry project , someone will look at Pull Request and do a code review before approving it.
GitHub will even run automated tests to your code and let you know if there is an issue with it. You will also be notified if there is any merge conflict between your code and the code in the master branch.
This may happen, if another programmer pushed a change to the master branch that may affects a file that you want to modified.
After the code has been reviewed, tested fully , and approved, your reviewer will give thumbs up to merge the Pull Request, else they will directly merge your pull request.
Even if we are working alone, getting used to create Pull Requests and the way to merge changes to the master branch. This is the basic workflow used by almost every open source project. If you ever contribute to one (you should!), understanding this three rules will make it really easy for you.
If you are still felt confused, just start and keep three rules in mind. Don’t try to overthink about “How” to do things yet and focus on “What” to do and “Why” it’s important for now.
Once the “What” and the “Why” are clear, you can figure out the “How”. Once you have repeated this process 2–3 times, it will become really easy and natural for you.
here we conclude the topic github and git fundamental the main reason behind the topic is to know the importance of git and github in order to keep records of our programs and projects the basic fundamentals of github is very necessary to understand and it is very useful for the maintaining the projects You can also check out our this post: Become a Git Expert