An alias that will generate a git commit message staged changes as shown in git-status. Put this alias (section below) in your .gitconfig
.
The message generated will be in the format of:
$ git status --porcelain
A file1.py
A file2.py
A file3.py
M file4.py
M file5.py
D README.md
R test.txt-> test2.txt
$ git commit-status
$ git log --no-decorate -n 1
bee4f8e Added: file1.py file2.py file3.py Modified: file4.py file5.py Deleted: README.md Renamed: test.txt-> test2.txt
Shared on Stack Overflow.
@Lukkian It's easy to add an interactive
[Yn]
prompt as well. Check this:It will look like
@isayakmondal Yes it's pure bash baked in to a string that git execute. The
!
in the beginning tells git it's shell script to execute in the string. It sure would make sense to put this in acommit-status.sh
script and just call that. The reason why I made it like this is that I wanted to provide a copy-and-pase:able solution that one can put directly in a.git-config
. But if you want to modify and extend this solution, you should really put it to a bash script yes :).