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

Talanta repair git pull last commit #1077

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

talanta88
Copy link

@talanta88 talanta88 commented Jan 2, 2020

新增方法

  def checkout_pull_branch(self, branch):
        '''
        切换到某个分支并拉取最新代码

        @param branch:
        @return:
        '''
        PyRepo(self.path).git.checkout(branch)
        PyRepo(self.path).git.pull()

方法使用位置:

def init(self, url, branch="master"):
       # 创建目录
       if not os.path.exists(self.path):
           os.makedirs(self.path)
       # git clone
       if self.is_git_dir():
           #self.checkout_2_branch(branch)
           #return self.pull()
           return self.checkout_pull_branch(branch)
       else:
           return self.clone(url)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant