How to edit incorrect commit message in Mercurial? [duplicate]

Update: Mercurial has added –amend which should be the preferred option now. You can rollback the last commit (but only the last one) with hg rollback and then reapply it. Important: this permanently removes the latest commit (or pull). So if you’ve done a hg update that commit is no longer in your working directory … Read more

Print commit message of a given commit in git

It’s not “plumbing”, but it’ll do exactly what you want: $ git log –format=%B -n 1 <commit> If you absolutely need a “plumbing” command (not sure why that’s a requirement), you can use rev-list: $ git rev-list –format=%B –max-count=1 <commit> Although rev-list will also print out the commit sha (on the first line) in addition … Read more

How do I make git use the editor of my choice for editing commit messages?

Setting the default editor for Git Pick one: Set core.editor in your Git config: git config –global core.editor “vim” Set the GIT_EDITOR environment variable: export GIT_EDITOR=vim Setting the default editor for all programs Set the standardized VISUAL and EDITOR environment variables*: export VISUAL=vim export EDITOR=”$VISUAL” NOTE: Setting both is not necessarily needed, but some programs … Read more