Fix of 'Commits being passed to custom hooks are already reachable when using the UI'
This is back-port of https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/563
What does this MR do?
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/19771
This MR changes the way how we create commit, we create it directly in the branch and we don't use temporary ref anymore. This also works similar to how git-receive-pack
works so it's a natural way to create commit.