Collaboration Specialist - GITHUB

Collaboration Specialist - GITHUB

Day - 8 of 90daysofDevOps

·

4 min read

Introduction

Git, a distributed version control system, has transformed how engineers manage their software. Git's robust capabilities allow teams to interact effortlessly, manage changes rapidly, and keep projects stable. In this blog, we will follow a fictional development team on their journey, demonstrating how Git's features help their workflow in a real-world use case.

Storyboard: The Journey of Team DevSquad

Meet DevSquad, a group of dedicated developers working on the cutting-edge online application "Widgetify." Let's follow them through the development process and see how Git plays a key role at each stage.

Use Case: Project Initialization

  • When the "Widgetify" concept is finalized, the team begins the project's initiation. They set up a new repository on a version control hosting site such as GitHub.

  • 🧑🏻The team leader, Sarah, creates the repository on GitHub. Sarah then shares the repository link with the team, allowing them to clone it locally.

Below are the terminal commands that Sarah ran to clone the git repo and change her working directory to widgetify:

git clone https://github.com/DevSquad/widgetify.git

cd widgetify

Use Case: Branching for Feature Development

The team uses feature branches in a collaborative workflow. To minimize conflicts and maintain the stability of the main branch, each developer works on a specific feature on their branch.

  • John, an expert developer with IAM skills starts working on the authentication module, creating a new branch for it.

Here is what John runs on his terminal to create a new branch

git checkout -b feature/authentication

Use Case: Staging and Committing Changes

As John works on the authentication module, he frequently stages and commits his modifications to keep a clean commit history. After implementing user login functionality, John stages the changes and commits them.

John thinks marking his code with comments will help him and his co-workers on the project make the code more readable. So he writes his script:

#Staging changes

git add .

#Committing changes

git commit -m "feat: Implemented user login functionality"

Use Case: Collaborative Code Review

To preserve code quality, the team conducts regular code reviews. They use pull requests to debate modifications and ensure that each contribution adheres to the project's guidelines.

  • John pushes his branch and creates a pull request on GitHub.

  • Other team members review the code and provide feedback.

  • After addressing the feedback, John's pull request is approved and merged into the main branch.

#Pushing changes to remote

git push origin feature/authentication

Use Case: Bug Fix with Revert

Bugs may be introduced during development at times. When a bug is discovered, the team makes advantage of Git's revert capability to safely undo individual commits without affecting the commit history.

  • Emily discovers a bug caused by a recent commit in the main branch.

  • Instead of directly modifying the commit, Emily reverts it to keep the history intact.

#Reverting the problematic commit

git revert <commit-hash>

Use Case: Maintaining a Clean History with Rebase

As more features are built in other branches, the team wishes to merge them back into the main branch while keeping a clean and linear commit history. They accomplish this using Git's rebase capability. Sam finishes working on a new UI component and rebases his branch onto the main branch.

#Rebasing feature branch onto main

git checkout feature/ui-component

git rebase main

Advantages of Revert and Rebase

  1. Non-destructive: Reverting and rebasing are both non-destructive processes. Revert keeps the original commits, but rebase creates new commit objects without modifying the previous ones.

  2. Collaborative Workflow: These instructions enable seamless collaboration in team settings. Using rebase, developers can rollback changes without harming other people's work and merge changes from the main branch into feature branches.

  3. Clean Commit History: By merging changes from one branch into another and lowering the number of merge commits, rebasing helps maintain a cleaner and more linear commit history.

Conclusion

Git, with its numerous features, is essential in the development process of teams such as DevSquad. Git enables developers to collaborate smoothly from project inception to collaborative code reviews and efficient bug repair, encouraging a culture of collaboration and code quality. Git remains the backbone of modern software development, ensuring version control and project stability throughout the development journey, thanks to its extensive capabilities. So, embrace Git and take your team's development process to the next level! Have fun coding!

Happy learning!