<!-- JSON-LD markup generated by Google Structured Data Markup Helper. --><script type="application/ld+json">{  "@context" : "http://schema.org",  "@type" : "Article",  "name" : "Git Branching Strategies",  "author" : {    "@type" : "Person",    "name" : "Subham Majavadiya"  },  "articleSection" : "Git Branching Strategies",  "articleBody" : [ "Master branch", "Integration branch", "Staging branch", "Dev-deploy branch", "Feature deployment", "Bugfix deployment" ],  "url" : "https://www.engati.com/blog/git-branching-strategies",  "publisher" : {    "@type" : "Organization",    "name" : "Engati"  }}</script>

Git Branching Strategies

Subham Majavadiya
|
4
min read
Git Branching Strategies

Introduction to git branching strategies

In one of the products we've worked on, we used ‘git’ for version controlling with GitLab as our hosting provider. In this article, we're going to discuss hands-on on git as well as the git branching strategies we follow. Along with recommendations on how to use git to accomplish work in a consistent and productive manner.

Git commands

git clone <remote origin url>

To create a copy of a git repository from the remote source to your local also set the remote to the original source so that you can pull/push on the same repository.

git checkout -b <branch_name>

To create a new branch from an existing branch with preserve the uncommitted/stash changes.

git branch

To check all the branch's revisions in your local system also helps in finding out which branch is currently active.

git add -p

To add content from the working directory into the staging area (or “index”) for the next, commit.

git commit -m <commit message>

Create a new commit containing the current contents of the index and the given log message describing the changes

git push origin <branch name>

To publish locally committed changes to origin.

git pull origin <branch name>

To fetch & merge changes from origin to your local branch.

git stash

To record the current state of the working directory and the index, but want to go back to a clean working directory.

git stash list

To list all the recorded index of the working directory/repository.

git stash pop

It does the same but leaves it in the stash stack.

git stash apply

To apply the top stashed element to your current working branch/directory and remove it from the stack

git log

To view commit history with SHA for current active branch

git reset — hard <commit SHA/ branch name>

To reset the active branch head to a particular commit or branch.

Git Branching Strategies

Master branch

Image for post


Integration branch


Image for post

Staging branch


Image for post

Dev-deploy branch

Image for post


Feature deployment

Image for post


Bugfix deployment

Image for post

Do’s and Don’ts

Image for post
Image for post

To sum it up

We hope this article will helps you use git in a more productive manner. Another tool that boosts productivity are chatbots. Get started with an Engati Chatbot today!

Tags
No items found.
About Engati

Engati is a one-stop platform for delighted customers. With our intelligent bots, we help you create the smoothest of Customer Experiences. And now, we're even helping you answer your customers' most complicated questions in real-time with Engati Live Chat. So, let's get started?

Get Started Free
Limited Time Offer - WhatsApp automation chatbot now available at a reduced price - 180 USD for 10K messages, 250 USD for 30K messages, 320 USD for 100K messages, all inclusive