?? Day 11 Task: Advance Git & GitHub for DevOps Engineers: Part-2 ??

?? Day 11 Task: Advance Git & GitHub for DevOps Engineers: Part-2 ??

?? Day 11 Task: Advance Git & GitHub for DevOps Engineers: Part-2 ??

Hello, fellow DevOps Engineers! In today's session, we're going to delve into some advanced Git and GitHub techniques that will enhance your workflow. Let's explore these concepts using simple English and a bit of code wizardry! ??????

  • Git Stash: ??

Git stash is your secret weapon for temporarily saving your precious code changes without making a commitment (literally!). This nifty command is perfect when you want to switch to a different branch without committing your current changes.

?? Here's how you can use it:

  • Task - 01

1. Create a new branch and make some changes.

2. Use 'git stash' to stash those changes. This will save them in a secret stash, away from your working directory.

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

4. To get your stashed changes back, use git stash pop.

Now, the changes you made in the first branch are applied on top of the new commits in the different branch.

Task-02: Feature Addition

  • 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 commitIn 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 featureCommit this with message “ Added feature2.2 in development branch”
  • Line4>> Feature 2 is completed and ready for releaseCommit this with message “ Feature2 completed”
  • All these commits messages should be reflected in Production branch too which will come out from Master branch (Hint: try rebase)


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

Make changes to the "development" branch and commit them.

  • Line3>> This is the advancement of previous featureCommit this with message “ Added feature2.2 in development branch"

Make the next set of changes and commit them.

  • Line4>> Feature 2 is completed and ready for releaseCommit this with message “ Feature2 completed”

Make the final change and commit it.
Switch to the "Production" branch.
Rebase the "Production" branch on the "development" branch to include the new commits.

This will reapply the commits from the "development" branch onto the "Production" branch. The commit messages will be reflected in the "Production" branch.


Cherry-pick: ?? Cherry-pick is like handpicking your favorite commits from one branch and applying them to another. It's perfect for selectively bringing changes from one branch into another.

  • In Production branch Cherry pick Commit “Added feature2.2 in development branch” and added below lines in it:
  • Line to be added after Line3>> This is the advancement of previous feature
  • Line4>>Added few more changes to make it more optimized.
  • Commit: Optimized the feature


Task-03:

In this task, you want to cherry-pick a specific commit from the "development" branch and make additional changes

  • Cherry-pick the commit "Added feature2.2 in development branch" to the "Production" branch

  • Line to be added after Line3>> This is the advancement of previous feature After cherry-picking the commit, make the additional changes by editing version01.txt:

  • Commit: Optimized the feature

Commit the changes with the message "Optimized the feature":

  • Now, you've successfully cherry-picked the commit from the "development" branch into the "Production" branch and made the requested additional changes, committing them with the appropriate message.


Resolving Conflicts:??

Conflicts can occur when you merge or rebase branches that have diverged, and you need to manually resolve the conflicts before git can proceed with the merge/rebase. git status command shows the files that have conflicts, git diff command shows the difference between the conflicting versions and git add command is used to add the resolved files.


#DevOps #Git #GitHub #Day11of90DaysDevOpsChallenege #90DaysDevOpsChallenege #awscloud #DevOpsWithCloud #GitBash #CherryPicking #tws #trainwithshubham Shubham Londhe


要查看或添加评论,请登录

Obaidur Rehman Khan的更多文章

社区洞察

其他会员也浏览了