Reputation: 823
I would like to know if it is possible/good practice to git branch -b "devfeature1"
if I'm on a branch already "dev"
.
In sourcetree I have trouble visualising this as it seems the show the branch of branch on the same branch. Am I doing it right?
Is it doing what i want to do and it's just not showing as I imagine it?
On master : git checkout -b "dev"
On dev : git checkout -b "feature1"
Visual example of what I want :
Thanks
Upvotes: 3
Views: 160
Reputation: 1386
Yes, this is common practice. And since branches in Git are just pointers to commits, this won't create any internal mess or something like that.
P.S. I'd also advice you to read about common Git Workflows. Those are common good-practices in using git branches. You may consider sticking to one of those depending on your needs and team size.
Approach you are talking about is somewhat called 'Gitflow workflow' It is described in a link above, and I personally like it and stick to it whenever possible (even in personal projects, where such structure isn't necessary at all).
Here is a cheatsheet for Git Workflow that is much more clear than Atlasian's description in a link above. There are also a lot of other materials in the Internet regarding the topic. Gitflow Workflow is kind of popular nowdays.
Upvotes: 4
Reputation: 14593
It is possible and good practice. There is even a name for it - Gitflow. You can read more about it here: https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow
Upvotes: 2
Reputation: 10040
That is a pretty common practice. I've worked at a few companies where the main branch is production
which has a branch for test
that has a branch
for dev
and then some devs will branch off for specific tickets say issues 313
, at which point when ready issue 313
gets merged into dev
, once approved dev
gets merged into test
, once approved test
get merged into production
.
Check out this google search for git branch diagram
you can see its common
Upvotes: 2