Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support checkout with a remote branch for cm pull repo #1356

Merged
merged 4 commits into from
Nov 23, 2024
Merged
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
8 changes: 6 additions & 2 deletions cm/cmind/repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,10 +482,14 @@ def pull(self, alias, url = '', branch = '', checkout = '', console = False, des
# When checkout only, we do not need -b for branch
extra_flag = ' ' if checkout_only else ' -b '

if branch != '':
if branch != '' and checkout != '':
# if both branch and checkout are specified, we do checkout and set remote branch
cmd = "git checkout -b " + branch + " " + checkout + " && git branch --set-upstream-to=origin/"+ branch + " " + branch

elif branch != '':
cmd = 'git fetch && git checkout ' + branch

if checkout!='':
elif checkout!='':
cmd += ' ' + checkout

if console:
Expand Down
Loading