Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Improving a git rebase workflow

Tags:

git

I'm currently working a very simple git workflow using feature branches and rebasing on to master before pushing.

git checkout -b feature
.. make some commits
git checkout master
git pull

If there are no changes from the pull:

git merge feature
git push

If there are changes:

git checkout feature
git rebase master
git checkout master
git merge feature
git push

While has been great to learn how git works but it's getting a little tedious to type all the time and I suspect there's some faster ways to achieve what I'm doing but can't find them.

like image 873
Nigel Sampson Avatar asked Feb 15 '23 11:02

Nigel Sampson


1 Answers

Your shortest amount of steps had a total of 6 steps (no changes case):

git checkout -b feature
.. make some commits
git checkout master
git pull
git merge feature
git push

This technique should work in both cases (6 steps as well):

git checkout -b feature
.. make some commits
git fetch
git rebase origin/master
git checkout master
git merge feature
like image 164
cforbish Avatar answered Feb 23 '23 02:02

cforbish