Git - Understanding the Basics
Git is a version control system for tracking changes in files and coordinating work among multiple people.
- Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
- Git is a distributed revision control system, meaning that changes are stored in a central repository and can be accessed from any computer in the world.
Installing Git
1. On Windows
- Download the Git for Windows installer from here.
- Install the Git for Windows installer
2. On Linux
- Open a terminal and type
terminal
sudo apt update
sudo apt install git
Configure Git
Open a terminal and type,
terminal
git config --global user.name "<YOUR_NAME>"
git config --global user.email "<YOUR_EMAIL>"
To verify that your Git configuration is correct, open a terminal and type,
terminal
git config --list
This will show you the current configuration.
terminal
user.name = "<YOUR_NAME>"
user.email = "<YOUR_EMAIL>"
Note
GitHub is a code hosting service for version control using Git.
Steps to make a Pull Request
1. Select a repo on GitHub
There are lots of repos on GitHub. You can search and find the repo you want. Choose the repo you want to pull requests from.
2. Fork the repo to your own account
Fork
3. Clone the repo to your local machine
Clone
Copy the HTTPS
clone link and paste it in your terminal. The link is like https://github.com/<USERNAME>/<REPO_NAME>.git
terminal
git clone <COPIED_LINK>
4. Open the repo in a code editor (for example, VS Code)
terminal
code <REPO_NAME>
5. Change, Add, and Commit your changes
Make some changes to the repo. After that, add all the changes you made to the repo and commit them.
terminal
git add .
git commit -m "Added some changes"
Push your changes to the remote repo.
terminal
git push origin main
6. Open a pull request
initiate PR
confirm the changes
PR description