Git - Understand The Basics
So what is git? A confusing one, isn’t it? Off course yes, until we learn the basics.
Git is like our own brain when we try to learn a new dish. Let’s assume Octocat loves cooking 👨🍳. One day he wanted to make a new dish, yummy dish 😋. He collected a lot of spices. First, he cooked a dish with a combination of spices. The taste was okay 👌, so he remembered the combination. He tried another combination. But ….. 😕 not tasty. So he just simply remembered the previous combinations of good taste and started modifying that. One day his friends came and learn the combination of the spices of the new dish and started modifying that.
In the technical term, git is a version control system with two main purposes — code backup and versioning. Remembering the combination of spices for the dish is code backup and try the previous combinations is code versioning.
a. Installing Git on Windows
For windows, the official release is available for download on Git website — https://git-scm.com/
b. Installing Git on Linux
sude apt update suco apt install git
c. Installing Git on macOS
Let's configure git -
git config --global user.name "<YOUR_NAME>" git config --global user.email "<YOUR_EMAIL>"
Type the following command to verify the configuration -
git config --list
This will output as follows -
GitHub - The Hub for our Codes
GitHub is a code hosting platform for version control and collaboration.
Steps to make a Pull Request
1. Select a repo on GitHub
There are a lot of repos on GitHub. If you are searching for beginner level projects, you can go for ‘good-first-issue’ or projects on your interest.
2. Fork the repo on your account
3. Clone the repo on your local machine
https link and copy the command. It's like -
git clone <COPIED_LINK>
4. Open the the repository in a code editor (eg VS Code, Atom)
git cd <REPO_NAME> code .
code is used to open the directory in VS Code.
5. Change, Add, Commit and Push
Make some valid changes on the repository. After changing the you need to add those changes to git —
git add .
After that make a commit for the changes -
git commit -m "<COMMIT_MESSAGE>"
Push the changes to GitHub
6. Open a Pull Request
Pull request is the way we propose our changes to accept in the parent repository.
🎉🎉🎉 Congratulations. You just learn the basics of git and pull request
You can also read the article in 👉 Medium.