remotemobprogramming / mob

Tool for smooth git handover.
https://mob.sh
MIT License
1.66k stars 147 forks source link

Directly specify remote ref when pushing. #373

Closed jstoneham closed 1 year ago

jstoneham commented 1 year ago

Users who have the Git config push.default=tracking, or other values, will have different default behavior on 'git push'.

Example: a newly created mob branch from origin/mainline is tracking origin/mainline until --set-upstream takes effect. The original git push, which is intended to push to origin/mob/mainline, will actually push the mob start commit to origin/mainline if push.default=tracking.

To avoid this scenario, we will always specify the remote ref we are pushing to.

jakemcc commented 1 year ago

:+1: to getting this change landed. We just spent the morning trying to figure out why mob kept pushing the newly created branch on top of origin/master and it came down to having push.default = tracking.

gregorriegler commented 1 year ago

Hi @jstoneham, sorry for my late reply. This is a nice find and I look forward to merge your PR to fix it. Would you be able to write a test for the behavior you expected but didn't occur?

jstoneham commented 1 year ago

I'll try. Sorry to report I'm on vacation at the moment but if I find some time!

gregorriegler commented 1 year ago

Oh! Enjoy your vacation 😃. No rush!

jstoneham commented 1 year ago

Please take a look at the new test. This test failed before I applied my change. I also did some more testing and removed some of the changes as only the single line is necessary to solve the case I was having trouble with.

gregorriegler commented 1 year ago

Thank you very much, @jstoneham !