Skip to content

Instantly share code, notes, and snippets.

@phdoerfler
Last active April 22, 2021 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phdoerfler/ffcf9b1cdcccafc636b2c75f0091c918 to your computer and use it in GitHub Desktop.
Save phdoerfler/ffcf9b1cdcccafc636b2c75f0091c918 to your computer and use it in GitHub Desktop.
HG

Reorder commits

hg convert --datesort

Try this first. However, in my case I saw no difference and moved on.

Lots of small pulls

That said, if you want to try you just need to use a series of hg pull -r REV commands into a new clone. Something like this:

hg init my_reordered_clone
cd my_reordered_clone
hg pull -r d84b1 ../un_reordered_clone
hg pull -r 6d269 ../un_reordered_clone
hg pull -r bb9e4 ../un_reordered_clone

If your workflow only merges branch heads, you can get the desired revision order by sorting revsets by date. This you can do with the following command:

hg log -r 'sort(0:tip, date)' --template '{rev}\n'

Source

HistEdit

Or with interactive rebase AKA HistEdit extension by reordering the lines in the text file

View chronologically (no graph)

hg log -r 'sort(all(), -date)'

Source

Sadly, no graph love

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment