🌳Day 9: Advance Git & GitHub for DevOps Engineers

Β·

3 min read

🌳Day 9: Advance Git & GitHub for DevOps Engineers

❄️What is Git and Why it is important?

Git is a distributed version control system that helps developers to manage their code changes.

πŸ›‘οΈwhy it is crucial:

  • Version Tracking: Git enables developers and users to track changes to files, allowing them to revert to specific versions as needed.

  • Collaboration: Multiple individuals can collaborate on the same project and seamlessly merge changes.

  • Local and Remote Repositories: Git stores files and their history locally but can also be utilized with online hosts such as Bitbucket or GitHub for collaborative purposes.

πŸŒ³πŸŽ“ Difference between the Main Branch and Master Branch?

🌳 Main branch: It's also referred to as the default branch in Git, typically where the most development happens.

πŸŽ“ Master branch: Historically used as the main integration branch, but some prefer using "main" instead due to its more comprehensive meaning.

πŸ»πŸ™ Difference between Git and GitHub?

🐻 Git: A software tool for local version control. Files and their history are stored on a local computer.

πŸ™ GitHub: A remote platform built on top of Git, where we can upload changes, collaborate, and share code with others.

πŸŒ€ How to create a new repository on GitHub?

Steps to create a repo:

  1. Log in to GitHub.

  2. Click the β€œ+” icon in the top right corner and select β€œNew repository.”

  3. Name your repository (e.g., β€œDevops”).

  4. Choose visibility (public or private).

  5. Initialize with a README (optional).

  6. Click β€œCreate repository.”

⚑ Difference between Local and Remote Repositories?

πŸ“ Local Repository: Stored on the local computer and used Git commands to manage it.

🌐 Remote Repository: Hosted on platforms like GitHub, encouraging collaboration and sharing.

πŸ“Tasks: Connecting Local to Remote Repository

🐾 Step 1: Set Git username and email

# Set Git username
git config --global user.name "Your Name"

# Show the username 
git config --global --get user.name

# Set Git useremail
git config --global user.email "you@example.com"

# Show the useremail 
git config --global --get user.email

🐾 Step 2: Create a new repository on GitHub (e.g., β€œDevops”)

🐾 Step 3: In the local repository, add the remote URL

# Initialize a Git repo locally.
git init 
git remote add origin <repository_url>

🐾 Step 4: Create a new file in Devops/Git/Day-02.txt & add some content to it

🐾 Step 5: Push local commits to the remote

git push -u origin main
OR
git push

Happy coding! πŸ˜ŠπŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

βœ… Feel free to reach out if you have any questions. I'm delighted to help! 😊

🀝 Let's Connect..!

πŸ”— LinkedIn

πŸ”— Twitter

πŸ”— GitHub

β˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈβ˜€οΈ

Β