Skip to content

docs: work on feature branch, rebase onto current master #7495

@ThomasWaldmann

Description

@ThomasWaldmann

Maybe we could add this to the developer docs.

Sometimes contributors work on new features (or other changes) in their local master branch.
This has some issues, like e.g.:

  • not being able to update the local master from upstream master
  • not being able to work on multiple different features/changes/fixes

Thus, best practice is to:

  • keep master branch just as an always up to date copy of upstream master
  • always work in separate feature / fix branches

Initial clean up, if work was already done in master branch:

git checkout master  # make sure this is a clean checkout without any pending stuff
git checkout -b MYFEATURE  # now you have your code in a feature branch
git checkout master
git log  # find the commit hash of the last commit before you began working on your feature
git reset --hard THATHASH
git pull borg master  # borg = upstream repo, updates your local master to the current state there

Now that we have a current master branch, we can also rebase our feature branch onto that:

git checkout MYFEATURE
git rebase -i master  # interactive rebase onto a current master branch
git log  # check: all looking good?
git diff master  # check: all looking good?
# if all looks good:
git push -f  # update your PR on github (force is required here)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions