Skip to main content

📌 Complete Git Topics for DevOps

 

📌 Complete Git Topics for DevOps



🌍 Shape Your Future with AI & Infinite Knowledge...!!

🌐 Want to Generate Text-to-Voice, Images & Videos? 👉 http://www.ai.skyinfinitetech.com 📚 Read In-Depth Tech & Self-Improvement Blogs 👉 http://www.skyinfinitetech.com ▶ Watch Life-Changing Videos on YouTube 👉 https://www.youtube.com/@SkyInfinite-Learning 🔥 Transform Your Skills, Business & Productivity – Join Us Today! 🔥



4️⃣ Branching and Merging

🔹 Creating and Switching Branches

Command:


git branch <branch_name> # Create a new branch git checkout <branch_name> # Switch to another branch

Best Practice: Use git checkout -b <branch_name> to create and switch to a new branch in one step.



🔹 Merging Branches

Command:


git merge <branch_name>

Best Practice: Always pull the latest changes before merging to avoid conflicts.



🔹 Handling Merge Conflicts

Command:


git status # Identify conflicts git diff # View conflict details

Best Practice: Manually resolve conflicts and commit the changes after resolving.



🔹 Deleting Branches

Command:


git branch -d <branch_name> # Delete a local branch git push origin --delete <branch_name> # Delete a remote branch

Best Practice: Delete unnecessary branches to keep the repository clean.



5️⃣ Working with Remote Repositories

🔹 Connecting with Remote Repositories

Command:


git remote add origin <repository_url>

Best Practice: Use git remote -v to verify the connected remotes.



🔹 Pushing Changes to Remote

Command:


git push origin <branch_name>

Best Practice: Use git push -u origin <branch_name> for the first push to set the upstream branch.



🔹 Pulling Changes from Remote

Command:


git pull origin <branch_name>

Best Practice: Always run git pull --rebase before making changes to avoid merge conflicts.



🔹 Forking a Repository

Best Practice: Forking allows you to create your own copy of a repository and contribute without affecting the original project.



6️⃣ Git Reset, Revert & Restore (Undoing Changes)

🔹 Reset (git reset - soft, mixed, hard)


git reset --soft HEAD~1 # Move HEAD back but keep changes staged git reset --mixed HEAD~1 # Move HEAD back and unstage changes git reset --hard HEAD~1 # Move HEAD back and discard all changes

Best Practice: Be careful with --hard as it permanently deletes changes.



🔹 Revert (git revert)


git revert <commit_hash>

Best Practice: Use git revert instead of reset when working in a shared repository to keep commit history intact.



🔹 Restore (git restore)


git restore <file>

Best Practice: Use git restore to discard changes in specific files without affecting the entire commit.



7️⃣ Stashing Changes

🔹 What is Stashing?

Stashing allows you to save uncommitted changes temporarily without committing them.


🔹 Using git stash


git stash # Save uncommitted changes git stash list # View stashed changes git stash pop # Apply the most recent stash

Best Practice: Use git stash push -m "message" to label stashes for easy identification.





📚 Top 5 Books That Will Change Your Life!(Top 5 Life-Changing Books) 🚀


1️⃣ Atomic Habits – Build powerful habits and break bad ones!

👉 Get it here: https://amzn.to/4ka28CJ

2️⃣ The Psychology of Money – Master your financial mindset!

👉 Get it here: https://amzn.to/3XiKFOA

3️⃣ Think and Grow Rich – Unlock the secrets to wealth and success!

👉 Buy now: https://amzn.to/4h51HGN

4️⃣ The Power of Your Subconscious Mind – Train your mind for success!

👉 Get it here: https://amzn.to/4idNPuR

5️⃣ Rich Dad Poor Dad – Learn financial lessons the rich teach their kids!

👉 Order here: https://amzn.to/3QzrmNa

Comments

Popular posts from this blog

Introduction to Terraform – The Future of Infrastructure as Code

  Introduction to Terraform – The Future of Infrastructure as Code In today’s fast-paced DevOps world, managing infrastructure manually is outdated . This is where Terraform comes in—a powerful Infrastructure as Code (IaC) tool that allows you to define, provision, and manage cloud infrastructure efficiently . Whether you're working with AWS, Azure, Google Cloud, or on-premises servers , Terraform provides a declarative, automation-first approach to infrastructure deployment. Shape Your Future with AI & Infinite Knowledge...!! Read In-Depth Tech & Self-Improvement Blogs http://www.skyinfinitetech.com Watch Life-Changing Videos on YouTube https://www.youtube.com/@SkyInfinite-Learning Transform Your Skills, Business & Productivity – Join Us Today! In today’s digital-first world, agility and automation are no longer optional—they’re essential. Companies across the globe are rapidly shifting their operations to the cloud to keep up with the pace of innovatio...

📊 Monitoring & Logging in Kubernetes – Tools like Prometheus, Grafana, and Fluentd

  Monitoring & Logging in Kubernetes – Tools like Prometheus, Grafana, and Fluentd Monitoring and logging are essential for maintaining a healthy and well-performing Kubernetes cluster. In this guide, we’ll cover why monitoring is important, key monitoring tools like Prometheus and Grafana, and logging tools like Fluentd to help you gain visibility into your cluster’s performance and logs. Shape Your Future with AI & Infinite Knowledge...!! Want to Generate Text-to-Voice, Images & Videos? http://www.ai.skyinfinitetech.com Read In-Depth Tech & Self-Improvement Blogs http://www.skyinfinitetech.com Watch Life-Changing Videos on YouTube https://www.youtube.com/@SkyInfinite-Learning Transform Your Skills, Business & Productivity – Join Us Today! 🚀 Introduction In today’s fast-paced cloud-native environment, Kubernetes has emerged as the de-facto container orchestration platform. But deploying and managing applications in Kubernetes is just half the ba...

🔒 Kubernetes Security – RBAC, Network Policies, and Secrets Management

  Kubernetes Security – RBAC, Network Policies, and Secrets Management Security is a critical aspect of managing Kubernetes clusters. In this guide, we'll cover essential security mechanisms like Role-Based Access Control (RBAC) , Network Policies , and Secrets Management to help you secure your Kubernetes environment effectively. Shape Your Future with AI & Infinite Knowledge...!! Want to Generate Text-to-Voice, Images & Videos? http://www.ai.skyinfinitetech.com Read In-Depth Tech & Self-Improvement Blogs http://www.skyinfinitetech.com Watch Life-Changing Videos on YouTube https://www.youtube.com/@SkyInfinite-Learning Transform Your Skills, Business & Productivity – Join Us Today! 🚀 Introduction: Why Kubernetes Security Is Non-Negotiable As Kubernetes becomes the backbone of modern cloud-native infrastructure, security is no longer optional—it’s mission-critical . With multiple moving parts like containers, pods, services, nodes, and more, Kuberne...