Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a faster way to integrate a feature branch?

Something I often find myself doing is, "Rebase a feature branch, merge it & delete it." To do that I run:

git rebase master feature
git checkout master
git merge feature
git branch -d feature

That seems quite laborious for something I'd imagine to be a common workflow. Does anyone know a faster way?

(Obviously I could write a script, but I'm wondering if there's a built-in approach I've missed.)

like image 880
Kris Jenkins Avatar asked Sep 21 '11 08:09

Kris Jenkins


People also ask

How do I merge feature branches?

Once the feature is complete, the branch can be merged back into the main code branch. First we run git checkout master to change the active branch back to the master branch. Then we run the command git merge new-branch to merge the new feature into the master branch.

Which branching strategy is best?

Git Flow is the most widely known branching strategy that takes a multi-branch approach to manage the source code. This approach consists of two main branches that live throughout the development lifecycle.

What is the best branching strategy in git?

Build your strategy from these three concepts: Use feature branches for all new features and bug fixes. Merge feature branches into the main branch using pull requests. Keep a high quality, up-to-date main branch.

What is better than GitFlow?

GitHub Flow is a simpler alternative to GitFlow ideal for smaller teams as they don't need to manage multiple versions. Unlike GitFlow, this model doesn't have release branches.


1 Answers

The general approach remains scripting or defining aliases, as illustrated in "Streamline your git workflow with aliases", except you might need a parameter as in "git alias with positional parameters":

rebmrg = "!f() { git rebase master $1; git checkout master ; git merge $1 ; git branch -d $1 }; f"
like image 93
VonC Avatar answered Nov 14 '22 01:11

VonC