英文:
What is the Mercurial equivalent of git checkout --patch (aka -p)?
问题
Mercurial 中是否有类似的命令?
英文:
The Git command git checkout --patch <commit>
allows you to interactively apply hunks from the diff between HEAD
and <commit>
to your worktree. In other words it allows you to prepare a commit that partially updates your repo to match a different commit.
Is there an equivalent in Mercurial?
答案1
得分: 2
One way to do this (and commit the changes) is:
hg恢复 -r <commit> --all
hg提交 --interactive
# 在交互式界面中取消选择除了您想要保留的内容之外的所有内容
hg恢复 --all
英文:
One way to do this (and commit the changes) is:
hg revert -r <commit> --all
hg commit --interactive
# Deselect everything except what you want to keep in the interactive UI
hg revert --all
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论