Is there a mercurial equivalent of git add -p
?
Quoting from man, git-add with the option -p (or --patch) does the following:
Interactively choose hunks of patch between the index and the work tree and add them to the index. This gives the user a chance to review the difference before adding modified contents to the index.
The Hg-Git plugin can convert commits/changesets losslessly from one system to another, so you can push via a Mercurial repository and another Mercurial client can pull it. In theory, the changeset IDs should not change, although this may not hold true for complex histories. Commands.
Overview. This extension adds the ability to work on a Git repository from Mercurial. It also allows using a Git server as a collaboration point for a team with developers using both Git and Mercurial.
The git add command adds new or changed files in your working directory to the Git staging area. git add is an important command - without it, no git commit would ever do anything. Sometimes, git add can have a reputation for being an unnecessary step in development.
There is no current plan to add Mercurial support to GitLab, but we are providing support to the Octobus team where needed as they work on Heptapod.
Have a look at the record extension (which comes bundled with Mercurial).
Note that since Mercurial doesn't have the concept of the staging area like git, running hg record
will simply allow you to examine, hunk by hunk, the modifications in your working copy. Any changes you choose to record will be committed, and any changes you choose not to record are simply left as modifications in your working copy.
The Record Extension is the standard tool for this. It allows you to pick hunks to include or not in a commit. Once you've enabled the extension in your hgrc, the command is just
hg record
The CRecord Extension gives you a TUI (Text User Interface) on top of this which allows you to go down to which lines you want to include. This isn't standard though, so it need downloading to a directory before you can enable it in your hgrc.
hg crecord
Edit:
The Record extension is no longer necessary since approx v3.4. Now various commands support the -i
or --interactive
flag. For example:
hg commit -i
...will ask you hunk by hunk what you want to include.
CRecord made it in to 3.8 as a core feature. Add the following to your .hgrc
[ui] interface = curses
Now, --interactive
commands will bring up the same interface as the old CRecord extension.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With