Rewrite project history #5
Labels
issue::crossrepo
Issue which relates to multiple project repositories
issue::enhancement
Issue which addresses a new feature request or proposal
issue::meta
Issue which addresses the project organisation, workflow and / or repository itself
Rewrite project history
Summary
This issue / proposal aims to address the complete rewriting of the whole project git history.
Description
About
Hello folks!
@just-a-stream entrusted me a role of barter-rs GitHub organisation owner (along with him, of course),
mainly in order to assist him with structuring the GitHub organisation, teams, project, repositories etc.
One of the first items on my repo "housekeeping agenda" is addressing some problems with the project git history.
Afterwards, I will continue to make other advancements to the repository organisation, backlog, docs, CI etc.
Yes, I actually took my time and reviewed over 400 existing commits in this repo
in order to get a better understanding of the project structure & history (roughly 10 hours of work overall).
Hey, at least I learned the project structure and how the things evolved over time.
Intro
This proposal (along with its associated upcoming PR) aims to completely rewrite the whole project git history,
in order to fix few major otherwise unresolvable issues which are currently present.
However, performing such an unprecedented change is a very brave & dangerous task with a lot of risks associated.
That is why this proposal is designed in such a way to honour the above-limitations, reduce the risks to zero,
and remove any and all dangers associated with it.
Motivation
This whole open-source project was started as a @just-a-stream's personal hobby project.
It is completely understandable that starting a small project from scratch does not assume doing "boilerplatey" tasks,
such as properly organising git branches or formatting git commit messages.
Once the project starts growing, the organic need for a stricter project organisation comes by.
Overall, the author did an amazing job of designing and open-sourcing such an ambitious project.
Nonetheless, it does not change the fact that some things should've / can still be organised better, as mentioned below.
This is a list of issues with a varying degrees of severity / significance:
(due to misconfiguration + lack of automatic author e-mail anonymisation feature on legacy commits made on GitLab)
develop
branch was merged intomain
branch without a fast-forward mergefeature/*
branches must be merged without FF mergefeat/*
branches weren't rebased when going out-of-date fromdevelop
,develop
was merged into themfeat/*
is when thefeature/*
is going to squash its changes(rebase-squash commits)
main
branch was entirely ignoredrelease/*
branches was almost entirely ignoredmain
main
branchhotfix/*
branch utilisationtopic:
prefixesfeat:
prefixAgain, all the mentioned issues are completely normal and to-be-expected from an emerging open-source project.
When starting out, a dev works fast and breaks things.
Nobody has the time for such an overhead of a task such as properly organising git branches, commits or commit messages.
However, that is why it is important to perform some "git housekeeping" tasks before taking the project public,
e.g. making a "public appearance".
Now is better than never. The project is still very young and in its early stage.
The transfer to GitHub is also very recent, so it would be a good idea to do it as soon as possible,
before there is a swarm of forks, pull requests, stars & open issues.
All the forks are from the devs who are in communication with each other in the community (at the time of writing),
so nobody will be surprised by the change, without being informed in advance and offered additional migration help.
Constraints
There are multiple constraints due to the fragility & delicacy of such a task.
In other words, nobody recommends to rewrite git history, devs are afraid of merge hells & force git pushes,
git rebase is not well-understood or liked etc.
This set of changes is designed with a strict respect to the constraints in mind:
Changes applied
Proposed solution to this problem is to carefully rebase the project's git history.
During the implementation of this solution, additional steps were taken to respect the above-mentioned constraints:
The result is a
develop-new
branch which is 1-to-1 compatible with the currentdevelop
branchthroughout all the versions of releases.
Achieved improvements
There are multiple benefits of this newly-rewritten project git history:
topic:
prefix keywords are properly utilised*
at the end of the commit message title / subject lineFooBar
;
.
git blame
& similar toolsVerification (steps to verify / reproduce the results)?
(expand)
Verification method: trust me bro
Nah, just kidding. You can really verify it yourself.
By performing the steps specified below,
you can easily check that all the changes are indeed compatible with the existing
develop
branch releases.You can run this shell script, which is hopefully written concise enough and well-documented with expressive comments.
Yes, I had to write it from scratch, what a waste of time.
compare-branches.sh
Verification process output log (sample)
Migration (merging issues)
If you run into issues while attempting to merge your forked branch back into this rebased
develop-new
branch,here are the steps you need to take to solve the issues:
git checkout <mybranch>; git checkout -b <mybranch-backup>; git checkout <mybranch>
(if not already checked out)
develop-old
branch (either via rebase or merge)develop-new
branchgit rebase --onto develop-new develop-old
git cherry-pick
all of your commits (which haven't yet been merged intodevelop-old
branch) into a new branchbased off / branched (forked) from
develop-new
git format-patch
and apply them to your newly createdbranch via
git am
(essentially the same as cherry-picking)OFAQ (Opponent Frequently Asked Questions)
This section is meant for individual(s) who might oppose to the idea of this proposal,
and offers an alternative view in form of common answers for common questions you (or they) might ask.
Well, such a generalised statement assumes some level of ignorance from your end.
Sure, if you are a dev who is just starting out and have an intern-level skills & experience, or are afraid of git,
then yes, treating the
git
tool as a black box, and avoiding common sources of problems & complications,such as rebasing, might be a smart approach.
But if you take your time to actually dive deeper into how git works,
then there is no reason to be afraid of some more aggressive git tasks,
as long as nothing breaks & all the existing constraints are satisfied.
Well, who cares about the version control at all? Why not just pack your code changes into a ZIP file,
upload it to Google Drive and share the link to other devs who want to collaborate?
Or even better, why not print out the new code which you wrote, pack it into an envelope / letter,
and ship it via postal service or use a homing pigeon who will deliver it to other devs?
We can go on and on like this... Same mentality, same level of ignorance, same answer.
Projects which have ambitions for growing and want to onboard a lot of new contributors (which we hope for here)
need a modern collaboration tools & approaches. Stricter order means less chaos, and more progress & advancement.
Is this really a question?
Anyhow, if you have read this verbose & overly-explained proposal writeup up to this point,
then you would've understood that nothing will actually break, and you won't have any problems merging your changes,
or submitting new PRs in future.
Future Considerations
There are some minor additional items which should be considered in future.
For one, all the future contributions should continue to respect the conventions discussed in this proposal,
and improve the overall quality of project code & structure.
Another thing, there is some concrete room for a future improvement:
topic:
type:feat
fix
test
refactor
perf
style
docs
build
chore
ci
revert
docs/CONTRIBUTING.md
fileConclusion
Pls just approve this proposal (and its associated PR) and let me take care of this stuff, I can handle it. Thx!
Outro
If any other contributor experiences issues with merging their work back to the repo (which is highly unlikely),
I am always available for one-on-one consultations, to help them resolve the issues without any trouble or pain.
But most likely, the problems won't even occur, or will be solved by running a single
git rebase
command(
git rebase --onto develop-new develop-old
if you will) in the worst-case scenario. But I repeat, unlikely.Thanks for taking your time to read this!
Sincerely,
@carpetmaker
Progress
This is a list of items which need to be performed:
barter-rs
project git repo historybarter-data-rs
project git repo historybarter-integration-rs
project git repo historybarter-execution-rs
project git repo historyThe text was updated successfully, but these errors were encountered: