1

この質問は、 とのマージを実行する方法に触れていますpygit2が、私の理解では、新しいコミットが発生します。リベースを実行する方法はありますか?これにより、新しいコミットが発生せず、特定のリモートからの最新のものに対応するようにブランチ参照が単純に早送りされますか?

4

1 に答える 1

2

Reference.set_target()で早送りできます。

例 (スクリプトがクリーンな状態でチェックアウトされたブランチから開始すると仮定して、 に早送りmasterします):origin/mastermaster

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)
于 2016-07-25T21:21:18.903 に答える