Day 13: Advanced Git & GitHub

Day 13: Advanced Git & GitHub


Introduction

In today's task, we dive deeper into Git's advanced features—branching, resetting, reverting, and understanding the differences between merging and rebasing. These commands are essential tools for any DevOps engineer looking to manage codebase versions, handle collaborative development, and ensure smooth delivery pipelines.


What You Will Learn:

  1. Git Branching Branching is a core Git feature that allows isolated development without impacting the main codebase. You can create multiple branches, work on features, and then merge them back into the main branch using pull requests.
  2. Git Reset and Revert These commands are useful when you need to undo changes. Reset removes changes from history, while revert creates a new commit to undo specific changes.
  3. Git Rebase vs Git Merge Both are used to integrate changes, but rebase rewrites history, making it a cleaner approach. Merging keeps the history intact, preserving the original commits from different branches.


Task Breakdown:

Task 1: Feature Development with Branches

Creating a New Branch:

  • First, create a branch from the master.
  • Add a feature to the newly created branch and commit the changes.


Article content

Push to GitHub:

  • Push your commits to GitHub for the dev branch.


Article content

Add More Features:

  • Update the file version01.txt with the following lines, committing after each change.


Article content

Reverting to a Previous Version:

  • Revert the file to a previous version where the content was “This is the bug fix in development branch”.


Article content

Task 2: Working with Branches

Branch Creation:

  • Create multiple branches and take screenshots of the structure.

Merging Changes into Master:

  • Make changes in the dev branch and merge them into master.


Article content

Practice Rebase:

  • Rebase the dev branch onto master and observe the differences.


Article content

Key Concepts Covered

  • Branching in Git: Allows parallel development without affecting the main codebase.
  • Git Reset vs Revert: Understand when to remove commits or create a new commit to undo changes.
  • Git Merge vs Rebase: Learn the differences in history management between merge (preserves history) and rebase (linear history).


To view or add a comment, sign in

More articles by Shubham Niranjan

Insights from the community

Others also viewed

Explore topics