What is Git?
Git is a Version Control System that Keeps track of all the changes or modifications made to the files by different people.
What is GitHub?
GitHub is a web-based platform that provides hosting for version control using Git. It is a subsidiary of Microsoft, and it offers all of the distributed version control and source code management (SCM) functionality of Git as well as adding its features.
What is Version Control?
It is the system that tracks all the changes made over time.
Types of version control systems:
Centralized Version Control System (CVCS)
Distributed Version Control System (DVCS)
Centralized Version Control System (CVCS)
A Centralized Version Control System (CVCS) uses a central server to store and manage versions of files. Developers check in and check out files.
Distributed Version Control System (DVCS)
Distributed Version Control System (DVCS) allows developers to "clone" an entire repository. They have a Full local copy, including history.
Why do we use distributed version control over centralized version control?
Better collaboration: In a DVCS, every developer has a full copy of the repository, including the entire history of all changes. This makes it easier for developers to work together, as they don't have to constantly communicate with a central server to commit their changes or to see the changes made by others.
Improved speed: Because developers have a local copy of the repository, they can commit their changes and perform other version control actions faster, as they don't have to communicate with a central server.
Greater flexibility: With a DVCS, developers can work offline and commit their changes later when they do have an internet connection. They can also choose to share their changes with only a subset of the team, rather than pushing all of their changes to a central server.
Enhanced security: In a DVCS, the repository history is stored on multiple servers and computers, which makes it more resistant to d
Difference Between Centralized and Distributed Version Control Systems
Git Installation ๐ ๏ธ
Git Installation on Linux๐ง:
Install Git using the package manager (Ubuntu):
sudo apt update sudo apt install git
Once the installation is complete:
git --version
After this, It should display the version.
Git Installation on Windows๐ฅ๏ธ:
Go to the Git for Windows website gitforwindows.org
Click on the Download button to download the latest version of Git for Windows.
Once the download is complete, double-click on the downloaded file to start the installation process.
Once the installation is complete, open the command prompt to verify whether Git is installed :
git --version
After this, It should display the version.
Create a new repository on GitHub
Go to GitHub and log in to your account.
Click on the "+" sign in the upper right corner and select "New repository."
Fill in the repository name and description.
Click on the "Create repository" button.
Clone the repository to your local machine ๐ฅ๏ธ
Open your terminal and navigate to the directory where you want to clone the repository.
git clone <repository_url>
cd <repository_name>
Make changes to a file๐
Open the file you want to change using a text editor or an IDE.
Make your desired changes to the file.
Commit the changes๐ง
git add .
git commit -m "Your commit message here"
Push the changes back to GitHub๐
git push origin master
Replace master with the branch name if you are working on a branch.
Now, if you refresh your GitHub repository page, you should see the changes reflected there.