/auto-message-commit

Auto message commit generator in Python

Primary LanguagePython

Github auto-message-commit

Create auto-message-commit app.

Usage

python3 app.py <auto/manual>

Logic

Checking all files changed by git add *.

If new file:

  • find all functions and name + arguments + return + comment on first lines after definition

If updated file:

  • if new function: name + arguments + return + comment on first lines after definition
  • if updated function: check name + arguments + return + comment on first lines after definition what changed or content of function changed
  • if deleted function:

If deleted file:

  • name of file + names of functions

TODO:

- [ ] Make function to create automate messages for commits - gathered by git log, diff and status - [ ] Check what status of edits of files exists on git (new, modified, deleted) - [ ] How to get context of git commands in python - [ ] Create script for adding *, commiting and pushing if commit message != old one - [X] Check what git commands use - [X] How to commit using file or other way - git commit -F

git commit

    [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]

    [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|reword):]<commit>)]
    [-F <file> | -m <msg>] [--reset-author] [--allow-empty]
    [--allow-empty-message] [--no-verify] [-e] [--author=<author>]
    [--date=<date>] [--cleanup=<mode>] [--[no-]status]
    [-i | -o] [--pathspec-from-file=<file> [--pathspec-file-nul]]
    [(--trailer <token>[(=|:)<value>])…​] [-S[<keyid>]]
    [--] [<pathspec>…​]


    --template=<file>
    When editing the commit message, start the editor with the contents in the given file. The commit.template configuration variable is often used to give this option implicitly to the command. This mechanism can be used by projects that want to guide participants with some hints on what to write in the message in what order. If the user exits the editor without editing the message, the commit is aborted. This has no effect when a message is given by other means, e.g. with the -m or -F options.

Git status after creating file and add tracking to it:

On branch main Your branch is up to date with 'origin/main'.

Changes to be committed: (use "git restore --staged ..." to unstage) new file: test_file

Git status after creating python_testing_for-status.py, changing README.md and deleting test_file:

On branch main Your branch is up to date with 'origin/main'.

Changes not staged for commit: (use "git add/rm ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: README.md modified: test.txt deleted: test_file

Untracked files: (use "git add ..." to include in what will be committed) python_testing_for_status.py

no changes added to commit (use "git add" and/or "git commit -a")

Git status after adding tracking of changes by git add *:

On branch main Your branch is up to date with 'origin/main'.

Changes to be committed: (use "git restore --staged ..." to unstage) modified: README.md new file: python_testing_for_status.py modified: test.txt

Changes not staged for commit: (use "git add/rm ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) deleted: test_file

Notes

- To chceck changes use - and + as added and deleted stuff from files, it comes from 'git diff'. - Maybe try to use openAI to summarize differences. - Create multiple versions to run script with parameters for things that git suggests.