Using Mercurial (hg), can you just "hg backout" all the commits you did for the files you don't want

Posted by Jian Lin on Stack Overflow See other posts from Stack Overflow or by Jian Lin
Published on 2010-06-15T00:05:15Z Indexed on 2010/06/15 0:12 UTC
Read the original article Hit count: 213

Filed under:
|
|
|

Using Mercurial (hg), can you just "hg backout" all the commits you did for the files you don't want to push, and then do a push?

Because Mercurial (or Git) won't let us push a single file or a single folder to another repository, so I am thinking:

1) How about, we just look at the commit we did, and hg backout the ones we don't want to push.

2) hg out -v to see the list of files that will be pushed

3) now do the push by hg push

Is this a good way?

This is because I got the following advice:

1) Don't commit that file if you don't want it to be pushed (but sometimes even just for experimentation, I do want to keep the intermediate revisions) (-- maybe I can hg commit and hg backout right away to prevent it from being pushed.)

2) Some people told me just to hg clone tmp from that repository i want to push to, and then copy the local file over to this tmp working directory, hg commit to this tmp repository, and then do a push. But I found that the hg clone tmp will take up 400MB of new data and files, and make the hard drive work very hard, just to push 1 file? So I would rather not use this method.

© Stack Overflow or respective owner

Related posts about git

Related posts about mercurial