Day 8/9 Task: Basic Git & GitHub for DevOps Engineers.
"Mastering Version Control: A Quick Guide to Git and GitHub Essentials"
What is Git?
Git is a distributed version control system for tracking changes in source code
It allows multiple developers to work on a project simultaneously, tracks changes over time, and supports features like branching, merging, and pull requests.
Git is widely used for collaborative software development.
What is Github?
GitHub is a web-based platform for hosting and collaborating on software development using Git
It provides tools for version control, code review, issue tracking, and project management
GitHub is widely used for collaborative coding and hosting open-source projects.
Version Control: Version control is a system that records changes to a file or set of files over time, enabling you to recall specific versions later. It helps in tracking and managing modifications made to source code or any other documents, facilitating collaboration among multiple contributors.
Types of Version Control Systems:
Local Version Control System (LVCS):
Description: It involves a simple database that keeps track of changes to files in a local repository.
Example: RCS (Revision Control System).
Centralized Version Control System (CVCS):
Description: A central server stores the version history, and users check out files to work on them.
Example: CVS (Concurrent Versions System), Subversion (SVN).
Distributed Version Control System (DVCS):
Description: Every user has a complete copy of the repository, allowing for more flexibility and collaboration.
Example: Git, Mercurial, Bazaar.
Why we use distributed version control over centralized version control?
Distributed Version Control Systems (DVCS) are preferred over Centralized Version Control Systems (CVCS) because they offer flexibility, independence for offline work, faster branching and merging, redundancy, and smoother collaboration.
DVCS, exemplified by Git, allows users to work independently, offline, and with faster and more efficient operations, making it well-suited for modern software development.
Create a new repository on GitHub and clone it to your local machine
step 1 :
step 2 : After creating a new repo we should click on creating a new file .
step 3 : In that file add some content in it and commit changes.
step 4 : To get the repo from the github to our local machine we should clone the repo for that we should copy the https link which is show in the image.
step 5: We should give the command "git clone <link>" in the terminal for cloning the repo.
step 6 : After cloning the repo we can see the file which we have cloned from the git .
Here I have made some changes in the github file.txt and commited the changes.
After that we should pull the file.txt changes from the github into our local machine so the changes made in github(file.txt) we can see in our local machine by pull command as shown in the image
Here I have made the changes in local machine as you can see in the image
Here i have modified the file and added the file and commited the file and I have pushed the changes to the github (file.txt).
After pushing the changes we can see that more commands are added in the github(file.txt) which changes were made in local machine .
THANK YOU FOR READING!