Checkout script adds commits to master from $CIRCLE_BRANCH


#1

I noticed that the output of git merge-base master HEAD was different on my local system than the CI system.

After some digging around I found something strange.

The commits on master and $CIRCLE_BRANCH are exactly the same (which should not be the case as the feature branch is ahead of master when opening a pull request).

This can easily be verified by running the log command

git log -n1 master has the exact same output as ``git log -n1 $CIRCLE_BRANCH`

This leads to problems when running tools that compare changes to the master branch. (such as pronto).

The workaround is a hard reset on master:

git checkout master
git reset --hard origin/master
git checkout -

Git checkout of a branch destroys local reference to master
#2

If I understand correctly,

We optimize checkout significantly and only guarantee that the current branch checkout matches the branch that should be built.

you could run git fetch && git merge-base origin/master HEAD to get your desired behavior

thanks!
RK


#3

That’s a good workaround as well. Luckily my tool allows injecting custom commit for merge-base. I don’t know how other tools handle this but it still feels wrong to have master and $CIRCLE_BRANCH including the same content.


#4