I have a question regarding git rebase
.
I have my main branch - call it dev
.
I have created a branch from dev - call it myTest
.
i have created another branch from myTest
- call it myTest/myTestPart1
----------+------------------- dev
\
--------+-------- myTest
\
------- myTest/myTestPart1
When someone push something to dev
I do
git checkout dev
git pull
then I do
git checkout myTest
git rebase dev
git push -f
then I do
git checkout myTest/myTestPart1
git rebase myTest
git push -f
Today another developer was working with me and he said I needed to do
git fetch origin
git rebase origin/dev
What is the difference between what i was doing and what he said to me?
Thank you
One difference is that he uses sentences that start with a capital letter and end with a period, and you don't. :)
What he's saying is that you're wasting a lot of effort and time and Internet bandwidth. You don't need to checkout dev
and pull it in order to rebase onto it. And since you don't need to checkout dev
, you don't need to swith to myTest
— because you are already on it.
The way to rebase myTest
onto latest version of dev
is to stay on mytest
and say
git fetch origin
git rebase origin/dev
You have to admit that's a lot shorter than what you're doing.