简体   繁体   中英

Python Script for Local Repository and Cherry-Pick for specific commit GIT

I want to create a python script for making local repository and I have no idea how to do this, after local repository I want to do cherry-pick for specific commit. Any tips for me?

Refer to below for what we have used to create a repo and some actions in Python:

Create repo

repo = git.Repo(os.path.abspath(repo_path))

Do checkout

repo.git.checkout(branch)
repo.git.checkout(commit_hash)
repo.git.checkout(tag_name)

Do cherry-pick commit hash 'fff1234'

repo.git.cherry_pick('fff1234')

You can refer to this URL for more details https://titanwolf.org/Network/Articles/Article?AID=0f484197-1dc3-4676-82c8-5359fad01f33#gsc.tab=0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM