diff --git a/exercise_utils/git.py b/exercise_utils/git.py index 5df9919..6fa8501 100644 --- a/exercise_utils/git.py +++ b/exercise_utils/git.py @@ -69,6 +69,10 @@ def push(remote: str, branch: str, verbose: bool) -> None: """Push the given branch on the remote.""" run_command(["git", "push", remote, branch], verbose) +def clone(repo: str, verbose: bool) -> None: + """Clone an existing repository""" + run_command(["git", "clone", repo], verbose) + def track_remote_branch(remote: str, branch: str, verbose: bool) -> None: """Tracks a remote branch locally using the same name.""" diff --git a/hands_on/pull_remote.py b/hands_on/pull_remote.py new file mode 100644 index 0000000..dc4743d --- /dev/null +++ b/hands_on/pull_remote.py @@ -0,0 +1,14 @@ +import os + +from exercise_utils.cli import run_command +from exercise_utils.git import clone + +__requires_git__ = True +__requires_github__ = True + + +def download(verbose: bool): + os.makedirs("samplerepo-finances") + clone("https://github.com/git-mastery/samplerepo-finances.git", verbose) + os.chdir("samplerepo-finances") + run_command(["git", "remote", "set-url", "origin", "https://github.com/git-mastery/samplerepo-finances-2.git"], verbose) \ No newline at end of file