Fix virtual merge commits creation
- Set user.email and user.name when creating a temporal detached merge commits.
- Fix detached merge commit creation condition.
- Do not create detached merge commit for the previous built image when previously built image contains latest commit.