Skip to content

Commit dfab78b

Browse files
committed
FIX: git reset --hard in case someone force pushed and fast-forward is not possible.
1 parent d482a94 commit dfab78b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

build_docs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,10 @@ def git_clone(repository, directory, branch=None):
166166
try:
167167
if not os.path.isdir(os.path.join(directory, ".git")):
168168
raise AssertionError("Not a git repository.")
169+
shell_out(["git", "-C", directory, "fetch"])
169170
if branch:
170171
shell_out(["git", "-C", directory, "checkout", branch])
171-
shell_out(["git", "-C", directory, "pull", "--ff-only"])
172+
shell_out(["git", "-C", directory, "reset", "--hard", "origin/" + branch])
172173
except (subprocess.CalledProcessError, AssertionError):
173174
if os.path.exists(directory):
174175
shutil.rmtree(directory)

0 commit comments

Comments
 (0)