Skip to content

Rebase Process Against Element Android

Yoan Pintas edited this page Jan 30, 2024 · 18 revisions

Rebase Process

Goal

Get news Element features / bugfix / security fix .

Theses 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-android) remote repository if you don’t have it

git remote add upstream [email protected]:element-hq/element-android.git --no-tags

Download Git LFS files from upstream

git lfs fetch upstream --all

Fetch specific tag from upstream repository

git fetch upstream tag vX.X.X

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

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

Merge the last element-android release in Tchap-android

git merge vX.X.X

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

git stash -u

git merge vX.X.X -m "Merge element-hq/element-android 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-android-X.X.X

Push queued large files to the Git LFS endpoint

git lfs push origin --all

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

When you PR is approved, you can squash your commits; only your merged commits not the element commits.

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

git commit --amend

git push origin rebase/element-android-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-android in Tchap-android.