commit-message

How do I edit an incorrect commit message in git ( that I've pushed )?

99封情书 提交于 2019-11-26 12:35:52
问题 I want to modify a commit message deeper in history and I\'ve pushed many new commits. How do I change the commit message? Is it possible? 回答1: The message from Linus Torvalds may answer your question: Modify/edit old commit messages Short answer: you can not (if pushed). extract (Linus refers to BitKeeper as BK): Side note, just out of historical interest: in BK you could. And if you're used to it (like I was) it was really quite practical. I would apply a patch-bomb from Andrew, notice

How do I prompt the user from within a commit-msg hook?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 09:22:20
问题 I want to warn the user if their commit message doesn\'t follow a certain set of guidelines, and then give them the option to edit their commit message, ignore the warning, or cancel the commit. The problem is that I don\'t seem to have access to stdin. Below is my commit-msg file: function verify_info { if [ -z \"$(grep \'$2:.*[a-zA-Z]\' $1)\" ] then echo >&2 $2 information should not be omitted local_editor=`git config --get core.editor` if [ -z \"${local_editor}\" ] then local_editor=$

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

三世轮回 提交于 2019-11-26 09:14:47
问题 This question already has answers here : Mercurial: how to amend the last commit? (7 answers) Closed 2 years ago . I am currently using TortoiseHg (Mercurial) and accidentally committed an incorrect commit message. How do I go about editing this commit message in the repository? 回答1: 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

Print commit message of a given commit in git

夙愿已清 提交于 2019-11-26 06:59:38
问题 I need a plumbing command to print the commit message of one given commit - nothing more, nothing less. 回答1: 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 to the commit message. 回答2: git show is more a plumbing

How do I make Git use the editor of my choice for commits?

社会主义新天地 提交于 2019-11-25 23:59:42
问题 I would prefer to write my commit messages in Vim, but it is opening them in Emacs. How do I configure Git to always use Vim? Note that I want to do this globally, not just for a single project. 回答1: If you want to set the editor only for Git, do either (you don’t need both): Set core.editor in your Git config: git config --global core.editor "vim" Set the GIT_EDITOR environment variable: export GIT_EDITOR=vim If you want to set the editor for Git and also other programs , set the