[maintenance] Refactor clone

1) Refactored git clone code to be more readable
2) Moved common code creating pack files to Pack