Github article about problems with contributions has no words about --no-ff
merges.
I've found some answers in this reddit thread, but process is still not clear for me.
EDIT: E.g. i have done some commits in feature branch, then i've merged this branch with master branch. Will Github count all commits from feature branch in my profile or only a merge commit?
First think about what the inverse of --no-ff
means: That you are doing a fast-forward merge.
Now what is a fast-forward merge? Essentially this means that you are just advancing the branch pointer without actually creating any commits. Since commits are the thing that record contributions (since they hold the author/committer information), fast-forwarding will obviously not result in a visible commit contribution to a repository.
The common repository hosting solutions do track pushes to the repository, so your updated push to a branch could be recorded as a contribution, but this is usually not done because it’s not recordable in the repository itself.
So, when looking at non fast-forward merges, this is where you actually create a merge commit that combines two (or more) diverging branches. A merge commit, being just a normal commit, will record the committer and author information properly, so this could count as a contribution.
So now let’s check what GitHub writes about what counts as contributions:
Commits will appear on your contributions graph if they meet all of the following conditions:
- The email address used for the commits is associated with your GitHub account.
- The commits were made in a standalone repository, not a fork.
- The commits were made:
- In the repository's default branch (usually
master
)- In the
gh-pages
branch (for repositories with Project Pages sites)
Condition 1 is handled by your local Git configuration and how you set up your GitHub account. 2 is self-explanatory and 3 essentially requires that the merge commit lands in the default branch. If you are merging with master, this would work.
In addition, at least one of the following must be true:
- You are a collaborator on the repository or are a member of the organization that owns the repository.
- You have forked the repository.
- You have opened a pull request or issue in the repository.
- You have starred the repository.
One of these should also be guaranteed if you have some sort of push access to the repository (either directly, or as part of a pull request).
So yes, a merge commit should count as a contribution.