this is a demo repository
main
- "Require status checks to pass before merging"
- "Require branches to be up to date before merging"
Didn't really do anything other than protect master from force-pushes.
Which is somewhat nice on its own, but it didn't prevent pushing to master.
this is a demo repository
We will
- checkout a new branch called
dev
on this repository. - make
dev
the base branch, on this repository. - delete the
master
-branch on this repository.
- Add branch protection with 6 reviewers to discourage merging to
dev
. - But we will "allow force pushes," because that
might come in handy in a secondallows us to update thedev
branch with themaster
from the other repository.
Clone the ubiquitous-pancake-dev
(origin) repository, as this is where we do the development.
git clone [email protected]:figaw/ubiquitous-pancake-dev.git
Add the ubiquitous-pancake
(prod) repository, as a remote where,
- developers have read-only access.
- "integration managers" have read-write access.
git remote add prod [email protected]:figaw/ubiquitous-pancake.git
See: https://git-scm.com/book/en/v2/Distributed-Git-Distributed-Workflows
- Checkout the "truth":
git checkout main
(there is onlymain
on prod) - Update the "truth":
git pull
- Start doing work:
git checkout -b feature/NG-123/newthing
- Do work:
touch file
,git add .
,git commit -m "ADD stuff"
- Deliver draft:
git push -u origin HEAD
- Branch is pushed to
dev
(origin) repository
- Branch is pushed to
- A PR is created on the dev repository, at some point it's ready to be merged and an intergration manager takes over.
- Checkout the branch of the PR:
git checkout feature/NG-123/newthing
. - Deliver change
git push prod HEAD
. (HEAD
means "current branch/commit") - Create a PR on the prod repository. (Maybe reference the PR on
-dev
..) - Merge to master on the production repository.
- Close the PR on
-dev
- Switch to the local truth:
git checkout master
- Update the local truth:
git pull
- Update the remote dev with truth:
git push origin master:dev
NB: at this point we could update the
-dev
repository with the changes inprod
but it's not really that interesting because all the developers are checking out the prod repository when they start making changes.
NB: I'm slightly uncertain as to the problems of not keeping the
dev
branch up to date. [Update] the problems are, PR's on-dev
will contain all the "missing" commits. Steps have been updated above.