#Day12 Git GitHub Advance.

#Day12 Git GitHub Advance.

Table of contents

In the previous blog Day11 You will find the notes for the below tasks.

Task-01

  • Create a new branch and make some changes to it.

  • Use git stash to save the changes without committing them.

  • Switch to a different branch, make some changes and commit them.

  • Use git stash pop to bring the changes back and apply them on top of the new commits.

  • Create a new branch and make some changes to it.

  • Use git stash to save the changes without committing them

  • Switch to a different branch, make some changes and commit them.

  • Use git stash pop to bring the changes back and apply them on top of the new commits.

Task-02

  • In version01.txt of development branch add below lines after “This is the bug fix in development branch” that you added in Day10 and reverted to this commit.

  • Line2>> After bug fixing, this is the new feature with minor alteration”

    Commit this with message “ Added feature2.1 in development branch”

  • Line3>> This is the advancement of previous feature

    Commit this with message “ Added feature2.2 in development branch”

  • Line4>> Feature 2 is completed and ready for release

    Commit this with message “ Feature2 completed”

  • All these commits messages should be reflected in Production branch too which will come out from Master branch.

Well, I added those lines in the file of version.txt one by one and committed all the changes one by one.

Main, motto is to combine all this commits which we made in the dev branch into the master branch in a linear order. here we will use git rebase command.

Simply switch to the master branch with below command.

git checkout master

git switch master

Once switch to the master branch all we need to get all commits under master branch is.

git rebase dev

Task-03

  • In the Dev branch create one file named cherry_pick.txt commit the changes with commit msg as Feat: This is a cherry-pick file" Then on the Production branch (master) get this specific commit only.

  • Add one random file in the dev branch after cherry_pick.txt to see the difference that only specific commits will be picked.

    Get the commit id of cherry-pick this item commit. and Switch to the master branch.

As we can see the file is not here, we can get that commit here in the master branch with Git merger //git-rebase. but it will pull all the other commits as well.

So, here cherry-pick command comes to rescue the user.

with the below command, we can pick a specific commit to get it merged in the prod/master branch.

git cherry-pick <commit id>

This is how we can pick the specific commit from any branch and merge it with cherry-pick.


Thank you for joining me on this journey into DevOps! Your curiosity is the driving force behind this exploration. If you found value in these insights, I'm thrilled! Keep the DevOps flame alive, and stay tuned for more exciting adventures in the world of technology. Happy Learning! 🚀✨"

"Closing the gap between us—let's connect and make our virtual bond stronger on social media!

Click on -Umesh Salunkhe