Set base commit


Ability to set a base commit for diffs to compare against.


This will allow you to set any SHA to be the base commit. Currently, in a pull request it uses where you branched off as the base commit. This can cause issues if you have a custom workflow.


In our case, on pull requests we

git checkout master
git fetch origin [branch]
git merge [SHA of branch head]

This means if there are additional commits on master, their coverage will now be part of the coverage diff for this pull.

master a . . b
pull    \ . . c

In this example, your diff will also include all the changes after a on master.

To fix this, I would want to pass the SHA for b to be the base commit for diff.

bash <(curl -s --base [COMMIT SHA]

In, my example I would set this to the SHA of b so that I only get my files included in the diff.

This thread also raised the need for this Flag -N to set the base report does not work


Thank you for the request, @scott!

Wanted to respond here to let you know that we’ve seen this and I’ve shared with product for them to review and prioritize. Thank you for making it.


We are also running into this issue which makes codecov really hard to use for our use-case as with a simple merge it seems to always pick the wrong commit (generally a commit on the feature branch rather than master)-- for example:

* 005 2020-02-21 | another commit on featurebranch
*   004 2020-02-21 | Merge branch 'master' into featurebranch
| * 003 2020-02-20 | another new commit on master Heller]
| * 002 2020-02-20 | new commit on master 
* | 001 2020-02-21 | first commit on featurebranch 
* 000 2020-02-20 | Master when branched

Codecov will pick 001, when 003 is the correct best master to compare to 001 isn’t even on master, yet codecov tries to use it as a base… For other purposes in our CI pipeline, we use git merge-base HEAD origin/master as a function to determine the best common base of the current head and master (and in github we use a squash and merge strategy to keep master linear). Anyway, hope this gets addressed soon!

Hey y’all, just clarifying a couple things for @scott @zheller and all future readers.

1.) We have a feature to manually pick parents of commits (docs)

2.) We do not have a feature to manually pick base of a PR.

3.) Codecov will always pick the base of the PR as where the branch happened (or prior). If you want to have the head of master as a comparison:

At that point, the only way to get this to work would be merge master into the feature branch so the head commit of master becomes the base commit of the feature branch.

Codecov should correctly show the diff of the feature branch with master merged into it.

Let me know any questions!