Skip to content

Instantly share code, notes, and snippets.

@klzns
Last active July 23, 2019 14:39
Show Gist options
  • Save klzns/e0c19c514b27358a771719a79d9a5bca to your computer and use it in GitHub Desktop.
Save klzns/e0c19c514b27358a771719a79d9a5bca to your computer and use it in GitHub Desktop.
Managing two render majors of an app

Contributing

In this document, we'll describe how we are dealing with the development of two major versions.

This document example have two branches:

  • master: major 0 of the app with render 7
  • 1.x: major 1 of the app with render 8

Development

The major 0 follows the default flow. Open feature branches from master, and open PRs to it. Publish new versions of major 0 in your feature branch. After released, merge it to master.

Upgrading major 1

Now it's time to update the 1.x branch. There's always two commits ahead of branch master: one with the update and another with the release commit.

Example of a 1.x branch (notice there's only two commits after master):

* 114ce6e Release v1.3.2 <Breno Calazans> 3 weeks ago (HEAD -> 1.x, tag: v1.3.2, origin/1.x)
* f5c39ee Update to react 3 and messages 1 <Bruno Dias> 3 months ago
*   ef5a630 Merge pull request #62 from vtex-apps/fix/alignment <Breno Calazans> 3 weeks ago (origin/master, origin/HEAD, origin/0.x, master, 0.x)
|\
| * 401aa45 Release v0.23.2 <Breno Calazans> 3 weeks ago (tag: v0.23.2, origin/fix/alignment, fix/alignment)
| * ebb2cd3 Profile last name field alignment <Breno Calazans> 3 weeks ago
...

We will always keep it short to two commits. Let's see how.

Run:

git checkout master
git pull # make sure your master branch is update to date
git checkout 1.x
git rebase master
Resolving conflicts

File: manifest.json

Keep the version from branch 1.x, example: between 0.3.4 and 1.2.1, keep 1.2.1. That will help when bumping a new version.

File: CHANGELOG.md

Keep both changes on the first and second commit. Add some missing line breaks where needed.

Rewriting commits

Run

git rebase -i HEAD~2

Fixup the lastest commit with the upgrade commit. This will merge the release commit with the upgrade commit into one.

Sanity check: Make sure you have only one commit ahead of master, like so:

* f5c39ee Update to react 3 and messages 1 <Bruno Dias> 3 months ago (HEAD -> 1.x)
*   ef5a630 Merge pull request #62 from vtex-apps/fix/alignment <Breno Calazans> 3 weeks ago (origin/master, origin/HEAD, origin/0.x, master, 0.x)
|\
| * 401aa45 Release v0.23.2 <Breno Calazans> 3 weeks ago (tag: v0.23.2, origin/fix/alignment, fix/alignment)
| * ebb2cd3 Profile last name field alignment <Breno Calazans> 3 weeks ago
...

Updating the changelog

Add to the Unreleased section, something like:

### Changed
- Get changes made at version `v0.3.0`.

And run:

git add .
git commit --amend --no-edit

This will merge this changelog changes to the upgrade commit.

Sanity check: Again, make sure you have only one commit ahead of master, like so:

* f5c39ee Update to react 3 and messages 1 <Bruno Dias> 3 months ago (HEAD -> 1.x)
*   ef5a630 Merge pull request #62 from vtex-apps/fix/alignment <Breno Calazans> 3 weeks ago (origin/master, origin/HEAD, origin/0.x, master, 0.x)
|\
| * 401aa45 Release v0.23.2 <Breno Calazans> 3 weeks ago (tag: v0.23.2, origin/fix/alignment, fix/alignment)
| * ebb2cd3 Profile last name field alignment <Breno Calazans> 3 weeks ago
...

Release

First, since we are doing a rebase here, force push the branch to remote.

git push origin 1.x -f

Sanity check:

* f5c39ee Update to react 3 and messages 1 <Bruno Dias> 3 months ago (HEAD -> 1.x, origin/1.x)
*   ef5a630 Merge pull request #62 from vtex-apps/fix/alignment <Breno Calazans> 3 weeks ago (origin/master, origin/HEAD, origin/0.x, master, 0.x)
|\
| * 401aa45 Release v0.23.2 <Breno Calazans> 3 weeks ago (tag: v0.23.2, origin/fix/alignment, fix/alignment)
| * ebb2cd3 Profile last name field alignment <Breno Calazans> 3 weeks ago
...

Then, use releasy as usual to release a new patch and push it again.

Finally resulting in:

* 114ce6e Release v1.3.2 <Breno Calazans> 3 weeks ago (HEAD -> 1.x, tag: v1.3.2, origin/1.x)
* f5c39ee Update to react 3 and messages 1 <Bruno Dias> 3 months ago
*   ef5a630 Merge pull request #62 from vtex-apps/fix/alignment <Breno Calazans> 3 weeks ago (origin/master, origin/HEAD, origin/0.x, master, 0.x)
|\
| * 401aa45 Release v0.23.2 <Breno Calazans> 3 weeks ago (tag: v0.23.2, origin/fix/alignment, fix/alignment)
| * ebb2cd3 Profile last name field alignment <Breno Calazans> 3 weeks ago
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment