Is there a way to set a comment for the next future commit using git? Imagine something like this:
git next-commit "Implement client-side validation"
# implement the feature ...
# commit changes
# equivalent to git commit -m "Implement client-side validation"
git commit -m from-next-commit
The motivation behind this is that I often have a particular feature in mind when I'm programming, but along the way I end up developing some other features or fixing related things and I lose track of the main task I was working on.
At that point I have modified the source code with useful changes, but I don't even remember what the main feature I added is, since it's all just a bunch of changes and the only commit message I can think of is git commit -m "Update stuff"
. Setting the message for the next commit could also help me keep working on what I was supposed to do. At any point if I feel like I've forgotten the main task and have derailed to other feature, I would ideally ask git with something like git next-commit
, which could print Implement client-side validation
.
Does a feature like this exist?
EDIT: after seeing some answers, I think I should clarify another thing. Ideally, this command would also help you keep track of when the future commit has already been used. For example, if you use git commit -m from next-commit
twice without setting a new future commit message before, it should fail.
$ git next-commit "Implement client-side validation"
ok
$ git commit -m from-next-commit
ok
# git commit -m from-next-commit
error : already used
$ git next-commit "Optimize get_request"
ok
$ git commit -m from-next-commit
ok