All Projects → thebearjew → Commit Comments

thebearjew / Commit Comments

Licence: mit
Build commit message in the comments of your code

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Commit Comments

use-bus
React hook to subscribe and dispatch events accros React components
Stars: ✭ 51 (-83.76%)
Mutual labels:  hooks, messages
Swr
React Hooks for data fetching
Stars: ✭ 20,348 (+6380.25%)
Mutual labels:  hooks
wp-documentor
Documentation Generator for WordPress.
Stars: ✭ 28 (-91.08%)
Mutual labels:  hooks
Waline
A Simple, Safe Comment System inspired by Valine | 一款基于 Valine 衍生的简洁、安全的评论系统
Stars: ✭ 260 (-17.2%)
Mutual labels:  comment
MouseInjectDetection
Simple method of checking whether or not mouse movement or buttons (<windows 10) are injected
Stars: ✭ 29 (-90.76%)
Mutual labels:  hooks
React Wait
Complex Loader Management Hook for React Applications
Stars: ✭ 268 (-14.65%)
Mutual labels:  hooks
Twenty48
A modified clone of the puzzle game 2048, built in react/typescript!
Stars: ✭ 31 (-90.13%)
Mutual labels:  hooks
Captain Hook
Custom React hooks for your project.
Stars: ✭ 298 (-5.1%)
Mutual labels:  hooks
Ice
🚀 The Progressive App Framework Based On React(基于 React 的渐进式应用框架)
Stars: ✭ 16,961 (+5301.59%)
Mutual labels:  hooks
Pre Commit Golang
Golang hooks for pre-commit
Stars: ✭ 261 (-16.88%)
Mutual labels:  hooks
M5ez
Complete interface builder for the M5Stack, an ESP32 based mini tinker-computer
Stars: ✭ 260 (-17.2%)
Mutual labels:  messages
mantine
React components library with native dark theme support
Stars: ✭ 4,390 (+1298.09%)
Mutual labels:  hooks
Radioactive State
☢ Make Your React App Truly Reactive!
Stars: ✭ 273 (-13.06%)
Mutual labels:  hooks
meteor-method-hooks
atmospherejs.com/seba/method-hooks
Stars: ✭ 24 (-92.36%)
Mutual labels:  hooks
Googlekeepclone
A clone of Google Keep with its original Material Design aesthetics
Stars: ✭ 281 (-10.51%)
Mutual labels:  hooks
react-movies-finder
React Movies finder is a React app to search movies and series using redux, redux-thunk, React Hooks, and Material UI
Stars: ✭ 27 (-91.4%)
Mutual labels:  hooks
Usehooks
Easy to understand React Hook code recipes
Stars: ✭ 3,075 (+879.3%)
Mutual labels:  hooks
Use Event Listener
A custom React Hook that provides a declarative useEventListener
Stars: ✭ 265 (-15.61%)
Mutual labels:  hooks
Constate
React Context + State
Stars: ✭ 3,519 (+1020.7%)
Mutual labels:  hooks
Trousers
hooks-first CSS-in-JS library, focused on semantics and runtime performance
Stars: ✭ 295 (-6.05%)
Mutual labels:  hooks

Commit Comments

Commit Comments automatically create a bulleted list of changes from comments in your code. Write comments using @commit keyword, and they will be added to your commit message when it's time to commit.

It works by using two Git hooks (prepare-commit-m sg and post-commit) to search your repository for @commit comments and construct a clean list of changes.

Once you've successfully committed, @commit comments are removed from your files

Installation

Clone the repository and move the prepare-commit-msg and post-commit files.

$ git clone https://github.com/thebearjew/commit-comments.git
$ cd commit-comments
$ chmod a+x prepare-commit-msg post-commit
$ cp prepare-commit-msg post-commit your-repository/.git/hooks 

Usage

As you're writing code, drop // @commit comments anywhere a significant change has been made.

Commit comments work with (inline & standalone):

  • C-like comments (C/C++, Java, JavaScript, etc.) //, /* */
  • Python/Ruby/Perl #
  • Assembly ;

Example:

foo.js

// @commit: Added a parameter to helloWorld function
function helloWorld(phrase) {
  console.log('Hello World + ' + phrase); /*  @commit - Concatenated strings */
}

Output in Git commit message

# Commit title goes here

- [foo.js#1] Added a parameter to helloWorld function
- [foo.js#3] Concatenated strings
# Changes to be committed:
#	modified:   foo.js 
#
# Changes not staged for commit:
# ...

Comments are removed from the original files.

foo.js - after commit


function helloWorld(phrase) {
  console.log('Hello World + ' + phrase); 
}

Ignoring Files

To ignore some files from being searched, create a .ccignore file in your repository and add file names/types.

README.md
build.sh
.cpp

Dependencies

  1. GNU sed is required to remove @commit comments in post-commit.

On Mac OS X, the default sed is from the FreeBSD distribution. To download the GNU sed version, use Brew

$ brew install gnu-sed --with-default-names

Without the --with-default-names option, the command will be downloaded as gsed.

  1. pcregrep is the primary search utility due to its widespread portability.

If pcregrep is not available, GNU grep is used (for Perl RegEx & variable lookback).

Contributing & Todo

Contributions to improve simplicity/resolve compatibility would be preferred. If there are useful improvements, tricks, or hacks, please submit a Pull Request and a directory of add-ons and snippets will be created.

TODO

  • [x] Add filename and line number to bulleted commit commets - suggestion by joncalhoun on HN
  • [ ] Use git diff --cached --name-status --diff-filter=ACM in place of git ls-files
  • [ ] Develop more test cases (finding edge cases with grep expression)
  • [ ] Rewrite sed commands to be POSIX (BSD) compatible regular expressions
  • Create more robust regular expression for validating comment syntax
    • [ ] Check for multiline block comments
    • [ ] Check for closing comment symbols (positive look aheads)
  • Programming Languages
    • [ ] HTML
    • [ ] Fortran
    • [ ] AppleScript

--

Special Thanks to Bryan Wyatt for feedback and bug fixes - @brwyatt

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].