Git rebase workflow

Hi all, Company is looking at adopting a more structured git workflow. One method we are looking at is creating local branches for development and then rebasing on main. One downside that was brought up was that since our feature branches would be local we can't have any collaboration with them (not a big deal imo) and that it makes transferring our work from different workstations difficult (this one is a big deal). If we want to adopt a rebasing strategy, what is the recommended approach for collaboration?
11 Replies
oldben
oldben3y ago
Do you currently have a pull request based work flow? What is the challenge you are looking to overcome?
benten
bentenOP3y ago
No we don't use PR's I guess what we want to do is work on feature branches where we rebase our changes, but we will end up squash merging these feature branches on main but we'd like to be able to push these feature branches to remote during development and worried that will cause some issues
oldben
oldben3y ago
When I worked for a company that used a similar approach, and didn't use PR's we pair programmed quite heavily. The idea being that the engineers keep each other honest, talk through the problems and come up with code not needing PR's. So that is how we collaborated. You can also use VSCode live share which is a good feature. One thing I found when I moved to a company using a PR based approach, was that the feedback on my code tended to be a lot better this way. Also lots of unit tests, integration tests, end to end tests so that we had even more confidence in our code.
benten
bentenOP3y ago
We don't do any of that tbh, we have to basically get code out the door as fast as humanly possible but we aren't building long-lasting apps or anything
oldben
oldben3y ago
I would heavily question why you would want to: - minimise collaboration - make squash commits so going through someone's code is harder to figure out their intentions. - have an increase in risk that if someone has an accident, all their work has to be reproduced by someone else, or wait until they can push the code up to a branch or get better to carry on with the work.
benten
bentenOP3y ago
Right, I'm not a big fan of having to keep our feature branches local which is why I was wondering if there is some way to have my cake and eat it too
oldben
oldben3y ago
You could keep your code behind a feature flag so you can push up code which is incomplete there are pros and cons, but means that you don't need to keep lots of commits local to your machine.
benten
bentenOP3y ago
hmm that could be promising idk
oldben
oldben3y ago
it might be worth asking the team to ensure that you can still get good feedback on your code before it gets into main and hits users
benten
bentenOP3y ago
we don't do code review lol
Gabriel
Gabriel3y ago
Don't rebase That's my take :p
Want results from more Discord servers?
Add your server