Is there a faster way to integrate function branches?

Something I often find is the "Rebase function branch, merge it and delete it." To do this, I run:

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

It seems very time consuming for something that I assume is a normal workflow. Does anyone know a faster way?

(Obviously, I could write a script, but I'm wondering if there is a built-in approach that I skipped.)

+6
source share
4 answers

The general approach remains a script or alias definition, as shown in β€œ Optimize git Workflow with Aliases ”, except that you may 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" 
+1
source

If you are already on the host, then it would be faster to simply combine it and remove it ( git merge feature and git branch -d feature ).

These are just two teams, and you avoid re-checking the old wizard just to fast forward.

You also just follow one solution instead of potential multiple resolution, as you may need to reload multiple function branch commits.

In addition, your story better reflects what was actually created. rebase destroys this story.

0
source

You can save one command (after forwarding, merging will be allowed to fast forward anyway):

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

But it's better to use aliases, as others suggested or don't collapse at all, just merge

0
source

It seems your merged branch is exactly the same as for rebase, so you can just rename it to master (where the -M flag to force it, since the master already exists)

 git rebase master feature git branch -M feature master 
0
source

Source: https://habr.com/ru/post/897736/


All Articles