Skip to content

Pull Request guidance

Paul Albertella edited this page May 14, 2025 · 1 revision

This page contains some (incomplete) guidance for submitting pull requests to the OSEP project.

What to do when the DCO check fails

To satisfy the LF DCO requirements all commits need to be signed off by the committer.

With one commit

This is easy to remedy if you only have one commit - just run the following commands in your local version of the repository:

    git checkout my_branch_name
    git fetch
    git rebase -i origin/main
    git commit --amend -s
    git push -f 

See below for a more detailed explanation of these steps

Note that the second and third commands here are not strictly necessary, but are good practice.

  • git fetch updates your local version of the repository from the upstream (by default called origin). Using this command is less risky than running git pull, because it does not make any changes to your local branches - it just updates the set of branches in the origin sub-tree. So the upstream version of main is origin/main.
  • git rebase -i performs an interactive rebase of your current branch onto the specified branch - in this case the 'main' branch of the upstream repository. This means that it takes the set of commits added to your branch since the point where the branch was originally created and applies them one at a time, in the sequence you committed them (or optionally a re-ordered sequence) on top of the specified branch (in this case origin/main). The result then replaces your branch (my_branch_name in this case) in your local version of the repository.

You must use git push -f (where -f means 'force') to push these changes upstream, because a rebase creates a new set of commits that effectively rewrite the history of the branch. The old commits still exist, but they are no longer referenced by the branch.

With multiple commits

If you have multiple commits on your branch that are missing a Signed-off by: line, then you will need to use an interactive rebase (see explanation above).

Here are the steps to do this:

  1. Checkout and update your local repo to the latest refs from upstream (origin)
    git checkout my_branch_name
    git fetch
  1. Rebase your branch onto the latest version of main from upstream
    git checkout my_branch_name
    git rebase origin/main
  1. Use interactive rebase to 'squash' your commits (see notes below)
    git rebase -i origin/main
  1. Sign the commit
    git commit --amend -s
  1. Force push the changes upstream
    git push -f

Squashing all your commits in an interactive rebase

Running command 3 above will open a temporary file (.git/rebase-merge/git-rebase-todo) in your configured text editor, which looks something like this:

pick 592fa39 First Draft ELISA Criteria Evaluation doc
pick 8b58358 Updated with feedback
pick 71c1db9 Added Review Ratings section with ratings and explanations.
pick 4d10faa Added NA criterion, Added further checklist questions to cover all criteria.
pick 901e0da Updated with feedback from review.
pick ccc8d31 Final updates for first draft.
pick d36a072 Added license.
pick 7b37489 Moved Evaluation Criteria document to the docs directory.
pick 723ea9b Added Document Criteria to main page.
pick 3d3698c Added Document Criteria to main page.

This is a list of all the commits on your branch, with the (short-form) commit hashes for each.

To 'squash' your commits into to a single commit

  • Leave the first line unchanged
  • Replace the pick designator at the start of each following line with s (or squash)
  • Save the file and exit your editor

So for the above example, the updated temporary file would be:

pick 592fa39 First Draft ELISA Criteria Evaluation doc
s 8b58358 Updated with feedback
s 71c1db9 Added Review Ratings section with ratings and explanations.
s 4d10faa Added NA criterion, Added further checklist questions to cover all criteria.
s 901e0da Updated with feedback from review.
s ccc8d31 Final updates for first draft.
s d36a072 Added license.
s 7b37489 Moved Evaluation Criteria document to the docs directory.
s 723ea9b Added Document Criteria to main page.
s 3d3698c Added Document Criteria to main page.

Other interactive rebase alternatives

If you wanted to keep all (or some) of your commits, then you could instead change pick to 'r(orreword). This would allow you to edit each of the commit messages in turn and add a Signed-Off by: My Name [email protected]` line. You would also need to do this for the first line (or run commend 4 as above).

Or, you could use 'e' (or 'edit') to edit a commit, allowing you to run command 4 and then run the following to proceed:

    git rebase --continue

IMPORTANT NOTE

If you ever get into a mess with a rebase, you can abort it by running:

    git rebase --abort

This will take you back to where you started, with (hopefully) no harm done.

Clone this wiki locally