Free cookie consent management tool by TermsFeed Generator git branch workflow: 7 easy steps (video) | Amir Kamizi
AMIR KAMIZI
Home Blog Courses Books Newsletter Store Membership Buy me a coffee
git branch workflow: 7 easy steps (video)

git branch workflow: 7 easy steps (video)

Last Updated on Nov 27, 2022

https://youtu.be/osNp79ew8f8

 

Transcription

Hello
This is amir
Today we are going to talk about git branching workflow
I will go through it step by step and help you understand the process

So let’s get started

First Step

The very first thing you should do is to make sure you are in the master branch. That way your new branch would be updated with all the latest changes in the master branch.
And in order to do that we need to run the command

git checkout master

Second Step

Then, run the command

git status

to make sure there is nothing to commit.

Third Step

Now it’s time to create a new branch. To do that we have 2 ways:

1- The first one is to create a branch and then checkout to it

git branch new-branch

And then go to it with

git checkout new-branch

2- The second way which is my favorite way is to combine the two mentioned commands. And we can achieve it by running this command

git checkout -b new-feature

The -b flag is telling git to create a new branch and then go to it

I’d like to add a side note about branch names. When you are working on a big project, sometimes it gets hard to track why a certain branch was created in the first place. I personally like to prefix the branches and give them a descriptive name. For example if we are adding a new feature for orders I would name it

feature-add-detail-to-order

Or if there is an issue I would name it

issue-with-the-sort-orders

Fourth Step

Ok as the 4th step, it’s time to do whatever you need to do.

Fifth Step

After you committed all your changes it’s time to go back and start the merging process.
And to do that you need to go to master branch first. So run the command

git checkout master

Sixth Step

And now you can merge your branch with the master branch by running this command

git merge feature-new-feature

* After this step there might be some merge conflicts. If there are then
Fix those and then run this command again.
Seventh Step

The last step is not necessary but it’s always a good idea to clean up afterwards.
In order to delete the branch that you’ve already merged run

git branch -d branch-name

The -d flag means delete the branch.
If you have not merged it already then git will show you a message saying that you haven’t merged it yet. It’s not possible to delete it.
Sometimes you really don’t want to merge it and you want to delete the branch. In that case you have to force the delete
You can do it by capitalizing the -d flag. And your command would be like this

git branch -D branch-name

And your done

Key Takeaways

Just a quick recap

We talked about 7 step git branching workflow to add a new feature or work on an issue
The steps were:

  1. Git checkout master
  2. Git status
  3. Git checkout -b branch-name
  4. Code & Commit
  5. Git checkout master
  6. Git merge branch-name
  7. Git branch -d branch-name

Final Words

and finally, if you liked what you learned please like and subscribe
That would be a great motivation to do more videos
If you have any suggestions or questions please leave a comment below and I try to answer them as soon as possible

That’s it
Have a wonderful day.

You can watch the original video on youtube.

Category: programming

Tags: #git

Join the Newsletter

Subscribe to get my latest content by email.

I won't send you spam. Unsubscribe at any time.

Related Posts

PHP Interacting with Python
Mar 22, 2023 programming

PHP Interacting with Python

Today we are going to talk about interacting with a python file in PHP. Both PHP and Python are very powerful languages. you can run a python program from your PHP code. ...

6 Min Read Read More
PHP Array Merge
Feb 14, 2023 programming

PHP Array Merge

Today we are going to talk about array merge function in PHP. This function is very useful and merges all the arrays that you pass as arguments and returns an array. ...

3 Min Read Read More
Vue.js Beginner to Advanced 2025: Complete Guide
Jul 21, 2025 programming

Vue.js Beginner to Advanced 2025: Complete Guide

Vue.js has evolved into one of the most popular JavaScript frameworks for building dynamic web applications. it continues to strike a balance between simplicity and capability, offering a progressive approach to front-end development. ...

33 Min Read Read More
TypeScript Beginner to Advanced 2025: The Complete Guide
Jul 18, 2025 programming

TypeScript Beginner to Advanced 2025: The Complete Guide

TypeScript is no longer optional for serious JavaScript developers, it’s essential. Whether you're building modern front-end applications with React, scaling backend services with Node.js, or contributing to large open-source projects, TypeScript is the industry standard in 2025. ...

23 Min Read Read More

Recommended Courses

Introduction to Machine Learning in PHP

Introduction to Machine Learning in PHP

Learn to Build Different Machine Learning Models Easily ...

PHP Tutorial Beginner to Advanced

PHP Tutorial Beginner to Advanced

Learn everything you need to start a successful career as a PHP developer ...