Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions hands_on/force_push.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from pathlib import Path
import shutil
from exercise_utils.cli import run_command

__requires_git__ = True
__requires_github__ = True

REPO_NAME = "samplerepo-things-force-push"
UPSTREAM_REPO = "git-mastery/samplerepo-things"
WORK_DIR = "things"


def download(verbose: bool):
work_dir = Path(WORK_DIR)
if work_dir.exists():
shutil.rmtree(work_dir)

# Fork to user's account and clone
run_command(
[
"gh",
"repo",
"fork",
UPSTREAM_REPO,
"--default-branch-only",
"--fork-name",
REPO_NAME,
"--clone=true",
"--",
WORK_DIR,
],
verbose,
)
Comment on lines +19 to +33
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pending comments from @damithc on the original hands-on discussion, but I don't think we need to fork the repository, cloning using git should be sufficient