After a merged pull request (PR) on GitHub with 3 commits on the remote repository (origin), I performed a pull to update my local repository (main). Somehow the things went wrong, with the standard CI tests failing locally. I reset the local repository to ignore the 3 commits using
git reset --hard SHA
and regained the local status before the PR. Then, to check the commits individually, I performed the pull explicitly using
git fetch origin
git merge SHA-commit1
git merge SHA-commit2
git merge SHA-commit3
and arrived to the same (functional) status as on remote, with all CI tests OK.
Just for completeness: I have on the remote side another PR proposal, which is not yet merged (containing some errors).
Although, my local and remote repositories are now practically the same, the command
git status origin
shows
On branch main
Your branch and 'origin/main' have diverged,
and have 3 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
I wonder if there is an easy way to sync the two repositories (I am afraid the suggested git pull would have the same effect as before). Thanks in advance for any hint.