Here, we are again with another beginner friendly blog. In this blog we will learn about one of the most popular version control tool, yes you guessed it right. I am talking about git.
In the blog we shall learn about -
- What is Version Control
- Why do we need Version Control
- Git, One of the best Version Control tool
- Start with Open Source Contributions
Let's start with the Version Control.
What is Version Control?
Version Control is a system which helps you to keep a track of all the changes you made in files or codes by keeping the track of each version you build so that you can rollback to previous version if needed. In layman language, it helps you to organize the things in a better way.
Why do we need Version Control?
Version Control provides an efficient way to manage your codes or files, but if you are thinking why exactly do we need it, let me give you an example.
Let's assume a scenario, today most of the companies are adopting Work From Home culture. Let's say we have 10 developers working on a product, building features for it from their home, so now how will they organize their code. Here comes the role of Version Control tools like git.
Still confused π€!
Let me give you another use-case. For example, you have build an application and deployed it. Everything works fine in the current version. Maybe you have added few new features and again deployed it but this time the application breaks. Now again comes the role of Version Control. By using version control tools such as git you can easily rollback to the previous version of your code.
This is how Version Control tools acts as a Savior
for almost every organization.
Introducing Git
In the above section we learned about Version Control and its need. Now let's understand what exactly is Git and why it is so popular in the industry. Git is a version control system which is adopted by many companies and OSS users to maintain their code in local as well as remote repositories. The term repository here refers to storage container where project files are being stored and it can be any repository, be it GitHub, GitLab or Bitbucket. It is mostly used in the Software Development Industry to keep a track of changes made in code and also helps to increase the speed of development by providing a better support for distributed/collaborative development environment.
Begin your opensource contributions
Now let's start with the open source contributions and learn about some of the most useful git commands which are used commonly.
[Note: The blog is specific for open source contributions so we will discuss only those commands which are related to it]
Step-1: For making any Open Source Contribution, first we need to fork the respective repository to your account. Here's how you can fork it -
After the fork is being completed, it would look something like this in your account -
Step-2: Now clone the forked repo in your system using the following command.
Replace RemoteUrl
with the URL of Repository you want to clone
git clone RemoteUrl
Step-3: Create a new branch for adding your changes. Use the below command, it will create a new branch and checkout into the newly created branch.
git checkout -b NewBranchName
To verify your current branch you can use git status
command. It will give you all necessary details of git initialized repository.
Step-4: Now make the changes which you want as your contributions. After the changes has been done, you need to add those changes to git. Use the following command to add those changes.
git add ChangedFileName
Also you can add all the changes by using period(.) If you have changed multiple files this can be really useful. Move to the root directory of the project and then run the following command.
git add .
Step-5: Now commit the changes you made with a commit message. The message should be relevant to the change you did as it would be helpful for tracing.
For example, I made changes in README.md file so the command would be something like this -
git commit -m "Added discord link in README"
[Note: It is not mandatory, but as a best practice you should add relevant commit messages]
Step-6: Now we need to push the changes we did. We have to push in the same branch in which we are working. Use the below command to push your change -
git push -u origin NewBranchName
Congratulations π! Now we are ready to raise our first Pull Request and make our first open source contribution.
Step-7: Go-to your forked Github Repository, you will see something like the below image. Click on Compare & pull request
button in the UI.
Step-8: After that add the necessary details asked, like title of PR, Description, etc and then click on Create pull request
button as you can see in the image below.
Tada! We just did our first open source contribution π.
What next?
Contribute & Earn Swags
Now we understood how we can start our open source contributions. If you want to do some quality contributions and be the part of biggest opensource fest, yes I am talking about Hacktoberfest, feel free to check out this repository and unlock the cool giveaways along with the Hacktoberfest swags.
Yes! You read it right. You will get some awesome giveaways from Devtron for contributing on their repositories apart from the hacktoberfest swags. Everyone at any level is invited to contribute and take the giveaways. Please refer the below repository for better understanding of the swags and contributions guidelines.
Top comments (8)
Thanks for sharing. Make sure to add your company & swags to the hacktoberfest swag list.
hacktoberfestswaglist.com/
Yeah sure,
Thanks for sharing the link. Will surely add it.
tks very useful
Glad you liked π
Thanks for sharing. You did a good and helpful guide.
Glad you found helpful π
Great read! πͺ
Thanks π