Rebasing a pull request

    • Files modified in your PR are in conflict with changes which have already been merged.

    Rebasing the branch used to create your PR will resolve both of these issues.

    Before you can rebase your PR, you need to make sure you have the proper remotes configured.Assuming you cloned your fork in the usual fashion, the remote will point to your fork:

    However, you also need to add a remote which points to the upstream repository:

    1. $ git remote add upstream https://github.com/ansible/ansible.git

    Which should leave you with the following remotes:

    1. $ git status
    2. On branch YOUR_BRANCH
    3. Your branch is up-to-date with 'origin/YOUR_BRANCH'.
    4. nothing to commit, working tree clean

    Once you have an remote configured, you can rebase the branch for your PR:

    This will replay the changes in your branch on top of the changes made in the upstream devel branch.If there are merge conflicts, you will be prompted to resolve those before you can continue.

    Once you’ve rebased, the status of your branch will have changed:

    1. On branch YOUR_BRANCH
    2. Your branch and 'origin/YOUR_BRANCH' have diverged,
    3. and have 4 and 1 different commits each, respectively.
    4. (use "git pull" to merge the remote branch into yours)
    5. nothing to commit, working tree clean

    Don’t worry, this is normal after a rebase. You should ignore the instructions to use git pull.We’ll cover what to do next in the following section.

    Since rebasing re-writes git history, you will need to use a force push:

    Your PR on GitHub has now been updated. This will automatically trigger testing of your changes.You should check in on the status of your PR after tests have completed to see if further changes are required.

    For help with rebasing your PR, or other development related questions, join us on our #ansible-devel IRC chat channelon .

    See also

    • Information on roadmaps, opening PRs, Ansibullbot, and more