Advance Git & GitHub for DevOps♾️

Git Branching

Git branching is a fundamental concept in the Git version control system. It allows you to create multiple lines of development within a single Git repository, making it easy to work on different features, bug fixes, or experiments simultaneously without affecting the main codebase.

Git Revert and Reset

git revert and git reset are two Git commands used to manipulate the commit history in a Git repository, but they serve different purposes and should be used in different situations.

1. git revert:

  • Purpose: git revert is used to create a new commit that undoes the changes made in a previous commit while keeping a clean commit history.

  • Usage: git revert <commit>

  • Effect: It creates a new commit that represents the opposite of the changes made in the specified commit. This is a safe way to undo changes because it doesn't alter the commit history; instead, it adds new commits.

    2. git reset:

    • Purpose: git reset is used to move the current branch pointer to a different commit, effectively rewinding or modifying the commit history. It can be used for tasks like undoing commits, moving branches, or staging/unstaging changes.

    • Usage: git reset [options] <commit>

    • Effect: It can be used in three modes: soft, mixed, and hard.

      • soft reset: Moves the branch pointer but leaves your changes staged.

      • mixed reset (default): Moves the branch pointer and unstages your changes.

      • hard reset: Moves the branch pointer and discards all changes.

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.

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 actually called “merge,” even though both procedures do essentially the same thing.

Today Task:-

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

  • add some changes to dev branch and merge that branch in master

  • as a practice try git rebase too, see what difference you get.

Day 10 of #90daysofDevOps

Thanks for reading

Follow me for more about DevOps♾️........

________________________________________________________________________________

#90daysHardChallenge

#Cloudcomputing

#DevOps

#Shellscripting

#TrainWithShubham