Day 10 Task: Advance Git & GitHub for DevOps Engineers.🚀

Day 10 Task: Advance Git & GitHub for DevOps Engineers.🚀

🚀Day 10 Task: Advanced Git & GitHub for DevOps Engineer🚀

Hey there, DevOps enthusiasts! Today, we're diving into some advanced Git and GitHub techniques. 🛠️

  • Git Branching 🌱

Branches are like separate playgrounds for your code, allowing you to work on new features, bug fixes, or experiments without disturbing the main branch. 🤹♂️

- The default branch is the main one, but you can create multiple other branches.

- Merging branches using pull requests keeps things organized.

  • Git Revert and Reset 🔙

Git provides handy tools for undoing changes:

- Git Revert: It helps you create a new commit that undoes a previous one. Perfect for keeping a clean history.

- Git Reset: This command lets you go back in time by modifying the branch pointer. It's a bit more forceful, so use it carefully.

  • Git Rebase and Merge 🔄


  • What Is Git Rebase? 🔄

Git Rebase allows you to integrate changes from one branch into another. It also cleans up your commit history. This is particularly useful when merging isn't ideal.

  • What Is Git Merge? 🤝

Git Merge is another way to combine branches. The key difference is that it keeps the original commit history intact. You'll often use this for simple branch merging.

It can be confusing, but both Git Rebase and Git Merge serve their own purposes. Understanding when to use each is essential. 🤔

  • Let's go through the steps to complete Task 1:

  1. Create a branch from master, add the "version01.txt" file, and commit it with the appropriate message:

Article content

  1. Push the 'dev' branch to the remote repositorygit push origin dev
  2. Add new commits to the 'dev' branch

Article content

  1. Restore the file to a previous version using git reset:

If you want to remove the last three commits and go back to the state before the changes, you can use git reset:

Article content

This will uncommit the last three commits. You can then force push the changes to the remote repository to update it

Article content

Now, the 'version01.txt' file should contain the original content: "This is the first feature of our application."

  • Task 2: To demonstrate the concept of branches and the use of git merge and git rebase, follow these steps:1. Create two branches:

Article content

  1. Merge 'feature-branch-1' into 'master':

Article content

3. Merge 'feature-branch-2' into 'master':

Article content

4. To practice using rebase:

Article content

This will move the commits from 'master' on top of the 'feature-branch-2' branch, creating a linear history. Use git log to see the difference in commit history between merge and rebase.

keep branching, merging, and rebasing! 🌳 #DevOps #Git #GitHub #CodingIsFun #DevOpsWithAWS #90DaysDevOpsChallenge #trainwithshubham #tws Shubham Londhe #AWScloud #amazonwebservices

To view or add a comment, sign in

Others also viewed

Explore content categories