Table of contents
Introduction: Welcome to Day 8 of your DevOps journey! Today, we dive into the fundamental realms of Git and GitHub, indispensable tools for efficient version control and collaborative development. Whether you're a seasoned engineer or a newbie in the tech world, understanding Git and GitHub is a pivotal step toward becoming a proficient DevOps practitioner.
What is Git?
Git, a robust version control system, empowers you to track changes to files and facilitate seamless collaboration among multiple contributors. Widely adopted in software development, Git extends its functionality to track changes across diverse file sets. With Git, you gain the ability to record contributors' modifications, revert files to earlier states, and merge changes effortlessly.
What is GitHub?
GitHub, a web-based platform and Microsoft subsidiary, serves as the hosting hub for Git version control. Beyond Git's core functionalities, GitHub introduces its features, making it a sought-after platform for developers to share, collaborate, and host both private and open-source projects.
Understanding Version Control:
Version control is a systematic approach to tracking changes in files over time. It enables users to recall specific versions, revert files or entire projects to earlier states, compare changes, identify contributors, and more. There are two primary types of version control systems:
Centralized Version Control Systems (CVCS): Utilizes a central server to store all versions, requiring developers to check out and check in files.
Distributed Version Control Systems (DVCS): Allows developers to clone entire repositories, work independently, and merge changes back into the main repository. Examples include Git, Mercurial, and Darcs.
Advantages of DVCS Over CVCS:
Better Collaboration: Every developer possesses a complete repository copy, fostering smoother teamwork.
Improved Speed: Local repository copies enable faster version control actions without constant communication with a central server.
Greater Flexibility: Developers can work offline, commit changes later, and selectively share changes with subsets of the team.
Enhanced Security: The repository history stored on multiple servers enhances resistance to data loss.
Certainly! Here's a detailed guide for the tasks outlined:
Task for Today:
1. Install Git:
If you don't have Git installed on your computer, follow these steps to download and install it:
Visit the official Git website at https://git-scm.com/downloads.
Choose the appropriate version for your operating system (Windows, macOS, Linux) and download the installer.
2. Create a GitHub Account:
If you don't have a GitHub account, creating one is quick and straightforward:
Visit GitHub's Sign Up page.
Enter your desired username, email address, and password.
Complete the account creation process.
Exercises:
1. Create a New Repository on GitHub and Clone it:
Now that you have Git installed and a GitHub account:
Log in to your GitHub account.
Click on the "+" sign in the upper right corner and choose "New repository."
Name your repository, add a description if desired, and click "Create repository."
Once created, click the green "Code" button, copy the repository URL.
Open your terminal or Git Bash, navigate to the desired directory, and use the command:
git clone <repository URL>
2. Make Changes to a File, Commit using Git:
Navigate to the cloned repository on your local machine.
Add a new file or make changes to an existing one.
Open your terminal or Git Bash, navigate to the repository, and use the following commands:
git status # View the changes git add <filename> # Stage the changes git commit -m "Your commit message here" # Commit the changes
3. Push Changes back to GitHub Repository:
After committing changes locally, it's time to push them to your GitHub repository.
Use the following command:
git push origin main # Push changes to the 'main' branch (adjust branch name if needed)
Refresh your GitHub repository page, and you should see the changes reflected.
🚀✨ #DevOps #Git #GitHub #TechLearning #Day8Task #DevOps #Git #GitHub #TechLearning #Day8Task 🚀#90daysofdevops #trainwithshubham✨