Skip to content

Rebase Process Against Element iOS

Phl-Pro edited this page Jan 4, 2023 · 10 revisions

Rebase Process

Goal

Get news Element features / bugfix / security fix .

These features could be integrated or hidden in Tchap.

It is recommended to do rebases regularly in order to avoid having big conflicts.

/!\ Choose a stable release version.

This method will help you during the PR review. You will have the possibility to compare the conflicts commit with the resolve commit.

First setup

Create branch from develop (this branch will have to be regularly updated): "element-rebase". We will merge all the rebases in this branch and after the branch will be merged in develop.

TODO for each rebase

Add upstream (element-ios) remote repository) if you don’t have it

git remote add upstream git@github.com:vector-im/element-ios.git --no-tags

Fetch specific tag from upstream repository

git fetch upstream tag vX.X.X

Create a new branch from origin (Tchap-ios) element-rebase

git checkout origin/develop -b rebase/element-ios-X.X.X

Merge the last element-ios release in Tchap-ios

git merge vX.X.X

Please RESOLVE conflicts or/and FIX build issue then stash to apply them later.

git stash -u

Restart your merge and commit without doing any changes and with the template message "Merge vector-im/element-ios vX.X.X into element-rebase"

git merge --abort

git merge vX.X.X -m "Merge vector-im/element-ios vX.X.X into element-rebase"

git add .

git merge --continue

Apply your changes and add them

git checkout stash -- .

git add .

git commit -m 'explain your changes here'

Remove tags coming from element

git tag --merged upstream/main | xargs git tag -d

git tag --no-merged develop | xargs git tag -d

Push your branch on the repository

git push origin rebase/element-ios-X.X.X

Create a pull request to merge your branch into element-rebase. (Don't squash element commits: we want to preserve the git history)

When your PR is approved, you can squash your commits, ONLY your commits, not the element commits.

At this step, your working tree should be clean, be sure that you don't have remaining uncommitted files.

git log --pretty=format:"%H" --merges -n 1 | xargs git reset --soft

git commit --amend

git push origin rebase/element-ios-X.X.X --force-with-lease

When PR was merged you should add a tag on the commit to checkout easily this merge in the future if necessary.

git checkout develop

git tag element_vX.X.X

git push origin refs/tags/element_vX.X.X

Well done ! You have successfully merged element-ios in Tchap-ios.