merge before commit method