<!-- 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>

Digital Transformation

Git Branching Strategies

Subham Majavadiya
.
Jul 20
.

Table of contents

Key takeawaysCollaboration platforms are essential to the new way of workingEmployees prefer engati over emailEmployees play a growing part in software purchasing decisionsThe future of work is collaborativeMethodology

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=""></remote>

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></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=""></commit>

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

git push origin <branch name=""></branch>

To publish locally committed changes to origin.

git pull origin <branch name=""></branch>

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=""></commit>

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

Git Branching Strategies

Master branch

Master Branch srategy


Integration branch


integration based strategy

Staging branch


Staging based strategy

Dev-deploy branch

Dev- deploy strategy


Feature deployment

Branching process for feature deployment


Bugfix deployment

Branching process for bug fix deployment

Do’s and Don’ts

DO's for Git Branching Strategies
Don'ts for Git Branching Strategies

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!

We will also soon be publishing it on GeeksforGeeks.

Share
Share
Subham Majavadiya

Andy is the Co-Founder and CIO of SwissCognitive - The Global AI Hub. He’s also the President of the Swiss IT Leadership Forum.

Andy is a digital enterprise leader and is transforming business strategies keeping the best interests of shareholders, customers, and employees in mind.

Follow him for your daily dose of AI news and thoughts on using AI to improve your business.

Catch our interview with Andy on AI in daily life

Continue Reading

Git Branching Strategies

Subham Majavadiya
|
4
min read

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=""></remote>

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></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=""></commit>

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

git push origin <branch name=""></branch>

To publish locally committed changes to origin.

git pull origin <branch name=""></branch>

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=""></commit>

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

Git Branching Strategies

Master branch

Master Branch srategy


Integration branch


integration based strategy

Staging branch


Staging based strategy

Dev-deploy branch

Dev- deploy strategy


Feature deployment

Branching process for feature deployment


Bugfix deployment

Branching process for bug fix deployment

Do’s and Don’ts

DO's for Git Branching Strategies
Don'ts for Git Branching Strategies

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!

We will also soon be publishing it on GeeksforGeeks.

Tags
No items found.
About Engati

Engati powers 45,000+ chatbot & live chat solutions in 50+ languages across the world.

We aim to empower you to create the best customer experiences you could imagine. 

So, are you ready to create unbelievably smooth experiences?

Check us out!