My âcleanâ Git Workflow
I have a history for having bad commit history, bad commit messages and overall bad git etiquette.
After working years as a freelance programmer, I now work full time at a mature company as a DevRel with tons of public repository. No more wild west style programming for me. Moreover, I don't work as a programmer anymore so, I try my best to avoid disrupting the workflow of my engineering teammates.
So, this is my "clean" git workflow.
Create a ticket to do something
Discuss the ticket with team mates. Ask around what to do.
Get an idea of what to do.
Come to final decision of what to do!
First clone the public repo on my local machine
Create a private remote repo
Delete .git file in my local machine repo
Git init on the local repo
Push content to the private remote repo
Invite teammates as colloborator on the private repo
Showcase progress to teammates
Avoid doing rebase, make changes with commits exclusively
Once team mates are satisifed, have it be reviewed and have it be greensignaled.
Download the private repo as zip file as a backup
Rename the local directory [1]
Delete the remote private repo
Create a fork of the public repo
Delete the content of the clone except for the .git file
Transfer the contents from renamed private local repo [1]
Make one single commit with a summary of changes as bullet points
Invite the teammates one more time as reviewers
Have you tried commit squashing with a remote repository?
Have you tried rebasing with a remote repository?
Doesn't work all the contents get downloaded anyway.
You are supposed to keep a "version history" with git
I have a version history on my private repo when I started working. But I don't need to push that history to a public facing repo! I have a ticket. What more do you need as "version history"!
What about merge conflicts?
At the very last step, I do a fork of the most recent version of the repo. That is how I avoid merge conflicts.
I invite people who need to colloborate on my local private repo. They can make changes there.
I don't work with monorepos. But I have seen how messy they can get. So this strategy should work with monorepos, no matter how pedantic you think it is. You could get some extra mileage with branches.
There must be a better way
I guess.... Feel free to let me know.