#90DaysOfDevOps Challenge - Day 10 - Advanced Git & GitHub for DevOps Engineers Part 1

Cloud Engineer and DevOps enthusiast, just talking about AWS, Docker, Linux, Kubernetes, Python, and automation.
Search for a command to run...

Cloud Engineer and DevOps enthusiast, just talking about AWS, Docker, Linux, Kubernetes, Python, and automation.
No comments yet. Be the first to comment.
The #90DaysOfDevOps Challenge is a dedicated initiative aimed at promoting continuous learning and skill development in the field of DevOps over a 90-day period.
Running your own home lab used to mean expensive hardware, complex networking, and hours of manual configuration. This project changes that. With a single Raspberry Pi, Docker Compose, and a few hundr

Welcome to an advanced hybrid directory demo where we'll guide you through setting up a hybrid environment, connecting to simulated on-premises infrastructure, creating a managed Microsoft AD within AWS, establishing a two-way forest trust, and integ...

Hello DevOps Community! Today marks the completion of the #90DaysOfDevOps Challenge, and it's a moment to reflect on the journey we've undertaken together. Throughout this period, I've engaged with various technologies, refining my skills in the DevO...

In a modern cloud infrastructure setup, creating a robust and scalable 2-tier architecture is essential. Such an architecture helps meet the demands of your applications while ensuring repeatability, reliability, and security. In this article, we'll ...

Welcome to Part 4 of my series on building a comprehensive CI/CD pipeline in AWS. In this article, I will explore AWS CodePipeline, a powerful service for building and deploying applications in a continuous integration and continuous delivery (CI/CD)...

Welcome to Day 10 of the #90DaysOfDevOps challenge. Today, we will explore advanced Git techniques, including branching, merging, and reverting. These techniques are essential for effective collaboration and version control in software development projects. So, let's dive in.

Git branching is a feature in Git that allows you to create separate lines of development within a repository. It enables you to work on different features or fixes simultaneously without affecting the main codebase.
Branches serve as independent workspaces where you can make changes, commit them, and merge them back into the main branch when ready. They provide a way to organize and manage different versions or streams of code within a project.
Git revert is a command that undoes a specific commit by creating a new commit that undoes the changes made in that commit. It is a safe way to undo changes without altering the commit history.
Git reset is a command that allows you to move the branch pointer to a different commit. It can be used to reset the branch to a previous state. However, it should be used with caution as it can discard or modify changes in the process.
In simple terms, git revert undoes a commit by creating a new one, while git reset moves the branch pointer to a different commit.
Git rebase is a command that allows you to update your branch with the latest changes from another branch. It rearranges the commit history by moving your changes on top of the updated branch. This helps create a cleaner and more straightforward history of your changes. It's useful for integrating changes, keeping your branch up to date, and making your commit history more organized before merging.
Git merge is a command that combines changes from different branches into a single branch. It takes the changes made in one branch and integrates them into another branch, creating a new commit that includes the changes from both branches. It's used to incorporate the work done in one branch into another, such as merging a feature branch into a main branch. The merge operation keeps a record of the individual branch histories and combines them into a unified branch history.
Refer to this article for a better understanding of Git Rebase and Merge Read here
In this task, we will demonstrate how to create a branch, add commits with different messages, and restore a file to a previous version. Follow the steps below:
Create a branch called dev from the main branch using the command:
git branch dev
git checkout dev

Add a text file called version01.txt inside the Devops/Git/ directory. Write the following content inside the file:
"This is the first feature of our application."

Commit this change with the message "Added new feature."

Push the dev branch to the remote repository using the command:
git push origin dev

Add new commits to the dev branch by modifying the version01.txt file with the following content:
This is the bug fix in the development branch
Commit this change with the message
"Added feature2 in the development branch."

Repeat this step two more times, adding the following content and committing with appropriate messages:
This is gadbad code
This feature will gadbad everything from now.
Restore the version01.txt file to a previous version where the content should be "This is the bug fix in the development branch."
Using the git log --oneline command, we can find the <commit> information and identify the commit you want to reset to.

We can use the git reset <commit> command to remove the last two commits where we added the second and third lines and move the changes to the unstaged area.


In this task, we will demonstrate the concept of branches, merging, and rebasing. Follow the steps below:
Create two or more branches with different names using the command git branch. In this case, I will use main and dev:
git branch dev
Make some changes to the dev branch and commit them. Take a screenshot of the commit history and branch visualization to demonstrate the concept of branches.

Merge the dev branch into the main branch using the command:
git checkout main
git merge dev

As a practice, perform a git rebase operation to see the difference it makes. Describe the differences you observe.

Merge preserves the branch structure and creates a new merge commit, while rebase rewrites the commit history and provides a linear sequence of commits. The choice between merge and rebase depends on the specific use case, project requirements, and collaboration workflow.
Congratulations on completing Day 10 of the #90DaysOfDevOps challenge. Today, we explored advanced Git techniques, including branching, merging, and reverting. These techniques play a crucial role in efficient collaboration and version control in software development projects.
Stay tuned for Day 11, where we will continue exploring Git and GitHub for DevOps Engineers in the second part of this topic.