diff options
| author | Alejandro Colomar <alx.manpages@gmail.com> | 2020-11-16 20:42:18 +0100 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2020-11-16 21:26:15 +0100 |
| commit | 1d8566691a36ae9908fe97efc151c2e3a98c9ffb (patch) | |
| tree | ba81348fd4edcce0a7c7f47ed97ff03a6bb7c370 | |
| parent | ebf47ac9da21f4a1f5756f5d5b5d5b6f41343112 (diff) | |
| download | man-pages-1d8566691a36ae9908fe97efc151c2e3a98c9ffb.tar.gz | |
Add script to get modified pages for commit messages
The script can be used this way:
git commit -sm "$(./scripts/modified_pages.sh): Short commit msg"
And then maybe --amend and add a longer message.
This is especially useful for changes to many pages at once,
usually when running a script to apply some global changes.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
| -rwxr-xr-x | scripts/modified_pages.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/modified_pages.sh b/scripts/modified_pages.sh new file mode 100755 index 0000000000..f6c4a6cea2 --- /dev/null +++ b/scripts/modified_pages.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +## SPDX-License-Identifier: GPL-2.0-only +######################################################################## +## +## (C) Copyright 2020, Alejandro Colomar +## This program is free software; you can redistribute it and/or +## modify it under the terms of the GNU General Public License +## as published by the Free Software Foundation; version 2. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details +## (http://www.gnu.org/licenses/gpl-2.0.html). +## +######################################################################## +## +## The output of this script is a +## list of all files with changes staged for commit +## (basename only if the files are within "man?/"), +## separated by ", ". +## Usage: +## git commit -m "$(./scripts/modified_pages.sh): Short message here" +## + + +git status \ +|sed "/Changes not staged for commit:/q" \ +|grep -E "^\s*(modified|deleted|new file):" \ +|sed "s/^.*:\s*/, /" \ +|sed "s%man[1-9]/%%" \ +|tr -d '\n' \ +|sed "s/^, //" |
