开发者

Mercurial Unstage Specific Files from Working Directory

I have an uncommitted changeset. I want to commit some of the changes, but not commit some of the files (like un开发者_如何学Cstaging a file in git). Can this be done in mercurial?


Use the -X option to hg commit to exclude certain files. You can specify it more than once on the command line. For example,

hg commit -X path/to/unwanted/file -X path/to/another/file


You can pass a list of files to commit to hg commit, e.g. hg commit -m msg file1 file2 ....


Yep! You have two options.

  1. Commit just some files.

    If you provide file names as arguments to hg commit, only those files will be committed. So if I have the following hg status:

    M foo.txt
    M bar.txt
    

    I can run hg commit foo.txt to commit just the changes to foo.txt and leave the changes in bar.txt for a later commit.

  2. Use the record extension.

    The Record extension gives Mercurial behavior to git's index, letting you commit just some patches of your changes (like git add --patch). See the docs for more info.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜