[git] DRY: extract common method