Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git workflow tips

I started using git and have been using it for couple of months now, and I am curious if my workflow is correct. I work from two different places on the project. here are the stages of my workflow:

  1. I pull the project from remote repo
  2. make a local branch for a new feature
  3. make changes and commit
  4. merge the branch with master
  5. push to the remote

is this correct way of working on the project?

like image 404
Headshota Avatar asked Apr 27 '26 10:04

Headshota


2 Answers

As Amber said :

First, let's just make something clear: there is no single "correct" workflow for Git. There are merely workflows that work - and specifically, workflows that work for you.

There is a good post on a blog about a good git workflow :

A successful Git branching model

You should read this post, it's really cool and you can adapt the workflow to your needs. In a nutshell, the workflow proposed by the blog post schematized like this :

A successful git branching model

I have adopted this workflow for a while. I try to always respect the workflow, whether it's a teamwork or working alone.

like image 78
Sandro Munda Avatar answered Apr 29 '26 00:04

Sandro Munda


First, let's just make something clear: there is no single "correct" workflow for Git. There are merely workflows that work - and specifically, workflows that work for you.

The workflow you have outlined is typically referred to as a "feature branch" workflow (where you create a branch to work on a given feature/fix/whatever, and then merge it back), and is a perfectly legitimate workflow.

If you only ever work on a single feature at a time, you could choose to simply commit directly to master, then push the updated version. This becomes difficult, however, if you're working on multiple different features simultaneously (whereas a feature branch workflow handles many simultaneous features gracefully).

like image 32
Amber Avatar answered Apr 29 '26 00:04

Amber



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!