This repo contains the end-user shell script implementing
git powercommit
command for committing and pushing the changes to your Git
repository. The script uses meaningless commit messages, performs pulls/stashes
as required and supports git submodules. Thus we try to automate a typical work
scenario of a lazy developer.
Disclaimer: Author tried to make this script clean and simple and even provided a test. But you know, Git is a complex thing, something may not work as expected. Use this script at your own risk.
The Powercommit algorithm in a nutshell:
- Check for changes, exit if there are none.
- Mark the current head with a branch
powercommit
. Exit if the branch already exists. - Call
git stash
- Call
git pull --rebase
- Apply the stash
- Call itself recursively for every git-submodule, unless
--no-recursive
is given - Commit every changed submodule
- Commit every changed regular file or folder, aggregating the files that share a folder into a single commit.
- Push the repo upstream
- Remove the
powercommit
marker branch. - Print a summary of untracked files. Highlight files which look like source codes.
- Drop this git-powercommit script into one of your PATH folders.
cd your-git-repo
- Make some changes
git powercommit
If the automation magic fails for some reason, you are advised to review the
/tmp/git_powercommit_$UID.log
logfile and recover to the starting state
manually:
- As one of its first steps, powercommit script pins the current state of the
repo with the
powercommit
branch. On the tip of this branch, it creates the stash capturing the currently modified files. Here is how to revert repo to the state just beforegit powercommit
was called:git reset --hard "powercommit"; git stash pop; git branch -D "powercommit"
You may need to repeat the above sequence for all submodules (recursive abort is
still in the TODO list). The script will refuse to run if the powercommit
branch already exists.
Also it is recommended to run the test script to check the script compatibility on mock repos.
- Hide verbose logging into the logfile.
- Nix-expression.
- A Screencast.
- Notify about suspicious untracked files.
- A recursive dry-run mode of execution.
- Commit added/removed files based on patterns.
- Make recursive recovering from failures.
- A Manpage.
- Neural network generating commit messages ๐ท
- Git status porcelain v2 https://git-scm.com/docs/git-status#_porcelain_format_version_2
- ANSI color codes in terminal https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
- StackOverflow on generating commit messages https://stackoverflow.com/questions/35010953/how-to-automatically-generate-commit-message
- PwC: On the Evaluation of Commit Message Generation Models: An Experimental Study https://paperswithcode.com/paper/on-the-evaluation-of-commit-message/review/