Day 10 : Advance Git & GitHub for DevOps.

Day 10 : Advance Git & GitHub for DevOps.

Table of contents

Here I have completed the task related to Advanced Git & GitHub Commands and some working examples with it.

Day 10 Task:

Git Branching

  • Use a branch to isolate development work without affecting other branches in the repository. Each repository has one default branch and can have multiple other branches. You can merge a branch into another branch using a pull request.

  • Branches allow you to develop features, fix bugs, or safely experiment with new ideas in a contained area of your repository.

Git Revert and Reset

  • Two commonly used tools that git users will encounter are git reset and git revert. The benefit of both of these commands is that you can use them to remove or edit changes you’ve made in the code in previous commits.

What Is Git Rebase?

  • Git rebase is a command that lets users integrate changes from one branch to another, and the logs are modified once the action is complete. Git rebase was developed to overcome merging’s shortcomings, specifically regarding logs.

What Is Git Merge?

  • Git merge is a command that allows developers to merge Git branches while the logs of commits on branches remain intact.

  • The merge wording can be confusing because we have two methods of merging branches, and one of those ways is called “merge,” even though both procedures do essentially the same thing.

Task 1:

Add a text file called version01.txt inside the Devops/Git/ with “This is the first feature of our application” written inside.

  • This should be in a branch coming from the master.

1

2


  • Switch to dev branch ( Make sure your commit message will reflect as "Added new feature")

3


1st line;> This is the bug fix in the development branch. Commit this with a message “Added feature2 in development branch”

3 1

2nd line\>> This is gadbad code. Commit this with a message “ Added feature3 in development branch"

3 2

3rd line\>> This feature will gadbad everything from now. Commit with message “ Added feature4 in development branch"

3 3

After all, commit a written view on GitHub.

3 4

Restore the file to a previous version where the content should be “This is the bug fix in the development branch”.

Using git rebase

3 5

3 6


Task 2:

Demonstrate the concept of branches with 2 or more branches with a screenshot.

4

4 1

Add some changes to dev branch and merge that branch in master

5

6

After Merge this as we have on GitHub.

Screenshot from 2023-03-19 01-57-39


Happy Learning :)

Did you find this article valuable?

Support DevOps by becoming a sponsor. Any amount is appreciated!