3 ms·
What if the same file has 2 separate commits you want to split up?
by brianwawok 12y ago
What if the same file has 2 separate commits you want to split up?
- campers 12y agoI just noticed recently that TortoiseHG lets you do that in the GUI. Definitely is a nice feature. I only just started using Git and did like the ability to cherry pick from a file, but happy to know I can still do that with hg.
- imakesnowflakes 12y agoActually Hg record can do this. It lets you 'edit' a hunk using a text editor, before adding it to the list of changes to include in the current commit....
- zak_mc_kracken 12y agoYes, this is a very underhyped feature. They're called "hunks" in git parlance: sections of the file that define a "diff". A diff on a file can be made of multiple hunks. Very often, my changes to a file are a mix of "fixing a serious bug" and "minor refactoring" and "removing dead code". When the time to commit comes, git makes it trivial to separate all these changes in different commits so that each commit does one thing and one thing only.
- ngoldbaum 12y agoYou can use "hg commit -i". This is a new feature in hg 3.4, but in older versions you can turn on the record extension.