Understanding workflows
This week marks the 6th week, in this new company. Whilst it's been a blast, with so many learning opportunities some unforeseen delays happened. My lead was down with covid during the first few weeks, then the following week I was down with covid too and till now we've not interacted much yet. But I'm hoping
Git Workflows
So on to the main stuff, this is a new git flow for me and I'm still trying to sort out how best to work with it. Previously, we had a sort of simple and easy way of doing the git stuff:
- Creating a Branch
- Updating a Branch from Master
- Pushing a Branch
Flow that I used to work with
So the easy way was to start from main/master by git checkout master
, then you would create a new branch git checkout -b newbranch master
which would then bring you to the new branch. Do some work, and whenever someone else PR is merged into master, all we need to do from our newbranch
was to do a git pull master
and git merge master
which would merge all the latest changes from master to your new branch. And then we just continue working on our own feature in our branch.
New Flow that seems easy yet tough
Now the hard part needs some getting used to here. The process now would be pretty much the same for creating a new branch, first git checkout master
to ensure you're in local master. Then git checkout -b newbranch master
. While working on the branch now, and if there is a new merge to master.
First we pull the latest merged changes with git pull master
then on the same working branch we do a git rebase master
. This is easy if there is no merge conflicts, all I need to do is git add .
and git commit -m "merge master"
and finally git push -f
which will force push with the rebase happening properly.
But if there is an issue with merge conflicts, you will then have to fix the file with the merge conflict(s), then its quite tedious as you will have to git rebase --continue
after every fix of the merge conflict. And then check if there's no issues with git status
.
There is of course 2 approaches which I've noticed, and that is to either use your IDE to fix the merge conflicts and then do a commit. Or use the CLI approach where you fix the file git add .
, git commit -m "merge conflict fix"
and then git rebase --continue
for every single file until all of it are fixed. Before finally doing a git push -f
force push which will complete the entire cycle.
Final thoughts
This new workflow definitely made me re-learn how git works, but after wrestling with the commands for abit. You'll slowly get used to it and the process becomes just like any other workflow you've worked with. Just alittle more complex thats all.
Being surrounded by geniuses really makes you learn fast and learn even more. Culture here is 10/10, everyone is so focused on what they're doing and so many domain experts to learn from. Really looking forward to learning more and enjoying the process.