Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit edc6a5a

Browse files
committed
open commit message in editor if not otherwise provided
1 parent 2be2e78 commit edc6a5a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

‎git-set-message.in.sh‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ h,help Show the help
88
99
a,all Update all branches from which the commit is reachable
1010
v,verbose Increase logging verbosity
11-
F,message-file= get message from file instead of stdin
11+
F,message-file= Get commit message from file
12+
s,stdin Get commit message from stdin
1213
"
1314

1415
all_branches=0
15-
message_file=
1616

1717
eval "$(git rev-parse --parseopt -- "$@" <<<$OPTS_SPEC || echo exit $?)"
1818

@@ -30,6 +30,10 @@ while (( $# > 0 )); do
3030
shift 2
3131
;;
3232

33+
(-s) message_file=
34+
shift
35+
;;
36+
3337
(--) shift
3438
break
3539
;;
@@ -69,6 +73,12 @@ for branch in "${branch_list[@]}"; do
6973
DIE "history contains one or more merge commits"
7074
done
7175

76+
if [[ -z ${message_file+UNSET} ]]; then
77+
message_file="$(git rev-parse --git-dir)/COMMIT_EDITMSG"
78+
git cat-file -p $oldref | sed '1,/^$/d' > $message_file
79+
${VISUAL:-${EDITOR:-vi}} $message_file || DIE "failed to edit message"
80+
fi
81+
7282
# generate a replacement commit object, reading the new commit message
7383
# from stdin.
7484
newref=$(

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /