This questionpygit2
과 병합을 수행하는 방법을 다루지 만, 내 이해를 돕기 위해 새로운 커밋이 발생합니다. 새로운 커밋을 초래하지 않을 리베이스를 수행 할 수있는 방법이 있으며 브랜치 참조를 주어진 리모트의 최신 버전과 일치하도록 간단하게 빨리 감기 할 것입니까?pygit2로 rebase를 수행하려면 어떻게해야합니까?
0
A
답변
1
Reference.set_target()으로 빨리 감기 할 수 있습니다.
예 (스크립트가 깨끗한 상태로 체크 아웃 master
지점에서 시작한다고 가정 origin/master
에 master
을 빨리 감기) :
repo.remotes['origin'].fetch()
origin_master = repo.lookup_branch('origin/master', pygit2.GIT_BRANCH_REMOTE)
master = repo.lookup_branch('master')
master.set_target(origin_master.target)
# Fast-forwarding with set_target() leaves the index and the working tree
# in their old state. That's why we need to checkout() and reset()
repo.checkout('refs/heads/master')
repo.reset(master.target, pygit2.GIT_RESET_HARD)
하는 REBASE. 그것은 빠른 전진 병합입니다. –
@WayneWerner 네, 맞습니다. 나는'pygit2'를 가지고 놀아서 현재 브랜치의 변경 사항을 리모트의 같은 브랜치의 최신 상태의 맨 위에 * 적용해야 할 것이다. – Piotrek