New branch is empty #26

Merged
dirkmueller merged 1 commits from adamm/git-importer:fix_inintial_branch into use_git_for_sha256 2024-06-10 17:03:48 +02:00

View File

@ -85,7 +85,7 @@ class Git:
"""Checkout into the branch HEAD""" """Checkout into the branch HEAD"""
new_branch = False new_branch = False
if branch not in self.branches(): if branch not in self.branches():
self.git_run(["branch", "-q", branch, "HEAD"]) self.git_run(["switch", "-q", "--orphan", branch])
new_branch = True new_branch = True
else: else:
ref = f"refs/heads/{branch}" ref = f"refs/heads/{branch}"