New branch is empty

New branches must be born empty
This commit is contained in:
Adam Majer 2024-06-10 15:35:11 +02:00 committed by Dirk Müller
parent 022ae5ab58
commit 6bd5d72100
No known key found for this signature in database

View File

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