ToyElephant
ToyElephant

Reputation: 205

How to merge uncommitted changes in files from one local branch to another using mercurial

I am working on a local branch and made changes to a set of files :

Now suddenly it was decided that changes in fileone.java and filetwo.java is a new mini-feature which should be separately pushed to remote repo. The plan is to continue development for other stuff.

I plan to do it by creating a new local branch where I want to merge only the first two files. What would be the recommended way of doing that using mercurial?

Upvotes: 0

Views: 47

Answers (1)

Mark Tolonen
Mark Tolonen

Reputation: 177406

Since you stated the files were only changed locally, the following assumes the files were new files:

hg add fileone.java filetwo.java
hg commit -m "mini-feature"
hg push

This will leave filethree.java uncommitted in the working directory.

Instead, if you made modifications to files already committed to the repository:

hg commit -m "mini-feature" fileone.java filetwo.java
hg push

This will commit the modifications to the named files, leaving modifications to filethree.java uncommitted in the working directory.

Upvotes: 1

Related Questions