how to exclude certain files from a push

Becker, Mischa J mischa.becker at kroger.com
Fri Oct 30 18:06:27 UTC 2020


> -----Original Message-----
> From: Uwe Brauer
> Sent: Friday, October 30, 2020 9:50 AM
> Subject: how to exclude certain files from a push
>
> Hi
>
> I have some (emacs) org files in my repository which I don't want to push.
> So I thought I could just add the org files to the .hgignore file and then push.
> But unfortunately it did not help, these files were pushed.
>
> So it seems I must run
> hg forget
> Then push and then add these files again, really? No other way around that?

Even if you forget them in the current commit, if you push the commits that have them, then anyone else who updates to those commits will also have those files.  The only way to not push files committed in your repository is to not push the commits that have them.

Some people use mq to keep those files as patches but the only part of mq I've ever gotten comfortable using is rebase. Instead I generally deal with this by putting commits to those files in a separate branch that never gets pushed.  You can even set the phase of the commits in the branch to secret to help keep them local.

This of course only works as long as you never merge this branch back into one of the branches you do push.  To make sure you never need to merge back, the only commits to this secret branch should be commits to the files you want to keep private and merges in from other branches.

Mischa Becker

________________________________

This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is confidential and protected by law from unauthorized disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.


More information about the Mercurial mailing list