我在Bazaar使用(重量级)结账,所以我不确定这对您来说是否完全相同,但您应该可以使用
switch
命令。例如:
mkdir source-repo
bzr init-repo --no-trees source-repo
bzr init source-repo/trunk
bzr co source-repo/trunk workdir
cd workdir
# Hack hack hack
bzr add
bzr ci -m "Done some stuff"
# Now create a branch and change the working directory files to match it
bzr switch -b my-new-branch
# We're now working on a checkout of ../source-repo/my-new-branch
# Hack hack hack
bzr add
bzr ci -m "Working on the branch"
# Now go back to the trunk (no -b as we're not creating the branch)
bzr switch trunk
# Working directory files now match the trunk branch
# Hack hack hack
bzr add
bzr ci -m "Changes to trunk"
# Merge in the changes from my-new-branch
bzr merge ../source-repo/my-new-branch
bzr ci -m "Merged my-new-branch"
当然,您也可以使用分支的绝对路径,但是相对路径可以节省大量的输入。不幸的是,merge命令需要完整路径。