Day 8 Essential Git and GitHub Skills for DevOps Engineers.
💻What is Git?
Git is free and open-source version control system. It remembers every change, who made it, and lets you jump back in time if needed. Perfect for teamwork, keeping track of edits, and never losing work again.
🌐What is GitHub?
GitHub is a web-based platform that goes beyond simply hosting Git repositories. It offers the full power of Git for version control and source code management but adds its own features like issue tracking, pull requests for code review, and project management tools. Popular among software developers, designers, and creative professionals, GitHub is a hub for open-source projects and collaboration.
🔄What is Version Control? How many types of version controls we have?
Version control tracks file changes over time, letting you revert files or entire projects to previous states. It helps compare changes, identify problem sources, and trace who caused issues and when.
There are two main types of version control systems: centralized (CVCS) and distributed (DVCS).
Centralized (CVCS): Uses a central server to store all project versions. Developers check out files, make changes, and check them back in. Examples: Subversion, Perforce.
Distributed (DVCS): Developers clone the entire repository, including the full version history. They work independently and later merge changes back. Examples: Git, Mercurial, Darcs.
Installation of Git:
We can install git in the Ubuntu environment by using the below command.
sudo apt-get update
sudo apt-get install git -y
After running these commands, Git should be installed on your Ubuntu system, and you can verify the installation by checking the Git version:
git --version
Exercises:
Create a new repository on GitHub and clone it to your local machine
➤Go to GitHub.
➤Log in to your account.(If not created sign up)
➤Click on the "+" sign in the top right corner and select "New repository".
➤Fill in the repository name, description, and other necessary details.
➤Optionally, initialize the repository with a README file.
➤Click "Create repository."
Install and configure the Git:
➤Install Git using
sudo apt install git
➤Configure Git with your user information
git config --global user.name "Your Name" git config --global user.email "your.email@example.com"
a. Replace "Your Name" with your actual name and "your.email@example.com" with your actual email address. The
--global
flag ensures that this configuration is applied globally to your user account.➤ You can check your Git configuration by using:
git config --list
Clone the Repository and Navigate into the cloned repository
git clone <repository-url> cd <repository-directory>
Make the changes and commit it using Git
git status # View the changes git add <filename> # Stage the changes git commit -m "Your commit message here" # Commit the changes
Replace
"Your commit message here"
with a concise and meaningful message describing your changes.Push changes to the remote repository.
git push origin <branch-name>
Replace
<branch-name>
with the branch you are working on.Ensure your GitHub is up-to-date, hit refresh, and voila – changes reflected successfully.
I believe this blog will be a valuable asset, bringing you fresh insights and enhancing your knowledge.
Happy Learning :-)😊
Subscribe to my newsletter
Read articles from Akash Jadhav directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Akash Jadhav
Akash Jadhav
👋 Hello! I'm Akash Jadhav, and I'm thrilled to welcome you to my DevOps journey on Hashnode. 🚀 With 1.6 years of hands-on experience in cloud migration, I'm now venturing into the dynamic world of DevOps. This blog will be your go-to place for tech insights, practical tips, and real-world stories as I navigate through this exciting field. 🌐 Join the conversation! Whether you're a seasoned pro or just starting, I encourage you to share your thoughts, questions, or experiences in the comments. Let's create a space for collaborative learning. Happy coding! Akash