8000 Adjust gitPython push call to handle detached head · Christian06810/python-sasctl@755da3f · GitHub
[go: up one dir, main page]

Skip to content

Commit 755da3f

Browse files
Adjust gitPython push call to handle detached head
1 parent d68471a commit 755da3f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/sasctl/pzmm/gitIntegration.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def pushGitModel(cls, gPath, modelName=None, projectName=None):
265265
mr.import_model_from_zip(modelName, projectName, zipIOFile)
266266

267267
@classmethod
268-
def gitRepoPush(cls, gPath, commitMessage, branch="origin"):
268+
def gitRepoPush(cls, gPath, commitMessage, remote="origin", branch="main"):
269269
"""Create a new commit with new files, then push changes from the local repository to a remote
270270
branch. The default remote branch is origin.
271271
@@ -275,14 +275,15 @@ def gitRepoPush(cls, gPath, commitMessage, branch="origin"):
275275
Base directory of the git repository.
276276
commitMessage : string
277277
Commit message for the new commit
278-
branch : str, optional
279-
Branch name for the remote repository, by default 'origin'
278+
remote : str, optional
279+
Remote name for the remote repository, by default 'origin'
280+
branch : string
281+
Branch name for the target pull branch from remote, by default 'main'
280282
"""
281283
repo = Repo(gPath)
282284
repo.git.add(all=True)
283285
repo.index.commit(commitMessage)
284-
pushBranch = repo.remote(name=branch)
285-
pushBranch.push()
286+
repo.git.push(remote, branch)
286287

287288
@classmethod
288289
def gitRepoPull(cls, gPath, remote="origin", branch="main"):

0 commit comments

Comments
 (0)
0