Rebasing

You should rebase changes that are requested during the Code Review phase into your previous commits.

In case you develop on a fork, you have to set up the canonical remote in your git config to rebase easily. Also, you might want to add rebase as the default merge strategy on pull, as in the example below.

cat .git/config 
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = git@github.com:edlerd/lxd-ui.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[remote "canonical"]
    url = git@github.com:canonical/lxd-ui.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[pull]
    rebase = true

With the above config, you can rebase a feature branch on your fork with the series of commands below.

git checkout main
git pull canonical main
git checkout fix-messages 
git rebase main 

If you face any conflicts during the rebase, resolve them manually with your favorite IDE and continue afterwards.

git rebase --continue

For more information on rebasing, you can refer to the official git documentation


Last updated 2 months ago.