Git Product home page Git Product logo

emoji-commit's Introduction

Emoji Commit

Make your git logs beautiful and readable with the help of emojis πŸŽ‰

The idea with the emoji committer is to tag each of your commit with an emoji that corresponds to a bump in semver. This information can the be used to automatically publish new versions, generate a change log and make the git log give you a quicker glance over whats been happening.

The emoji committer in action

Table of contents

Installation

cargo install emoji-commit

Usage

The emoji committer can be used in two ways. Either invoked directly, or by configuring git to invoke it.

Invoke directly

Simply call emoji-commit as you would any other command:

emoji-commit

Configure Git

You can set the core.editor configuration in git the the emoji committer to always use it when committing.

git config --global core.editor 'emoji-commit'

The emojis

The following emojis where chosenΒ for the emoji committer:

Emoji Name Semver Meaning
πŸ’₯ Collision major Breaking change
πŸŽ‰ Party popper minor New feature
πŸ› Bug patch Bugfix
πŸ”₯ Fire patch Cleanup / Performance
🌹 Rose Meta

πŸ’₯ Breaking change

Use this commit type if your change is in any way breaking to the intended consumer. Keep in mind that "breaking" has different meaning in different contexts, e.g. adding a field to a struct is a breaking change in Rust, but is generally considered a backwards compatible change in Node.js.

πŸŽ‰ New feature

Use this commit type if you have added a new feature in a fully backwards compatible way. Keep in mind that adding documentation for a previous undocumented feature can qualify under this type, since undocumented APIs aren't a part of the public API.

πŸ› Bugfix

Use this commit type if you have fixed a bug. The rationale for having two "patch" types is to be able to quickly get a list of all the bugs that have been fixed.

πŸ”₯ Cleanup / Performance

Use this commit if your change will impact the consumer in some way, be it a documentation change, optimizing an if-statement or simply removing some unnecessary semicolons.

🌹 Meta

Use this commit when you change won't have any impact on the consumer. This does not include changes to the code that still should have it "behave the same" since those changes should result in a new build being published.

A common use case for this emoji is editing your .travis.yml file to change something with the build, or adding some more tests.

The version bump

Many publishing tools, e.g. npm, have a step where you'll bump the version in some file, committing that, and then publish everything to a registry. For this specific use case we have introduced a special emoji.

🚒 Release

Use this commit type when cutting a new release. Commits with this emoji should preferably be made automatically by some sort of continues delivery system, which also publishes the package.

I hope to release some tools for making this easier in the near future. In the mean time, you can use this handy shortcut for npm:

npm version <bump> -m '🚒 %s'

Troubleshooting

git log doesn't show emojis on macOS

macOS ships with a very outdated less that doesn't support showing emojis out-of-the box. Read more in this blogpost for a proper solution, or run the following command to make it workβ„’.

git config --global core.pager 'less -r'

emoji-commit's People

Contributors

albinekb avatar cstruct avatar linusu avatar oscarjohansson94 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

emoji-commit's Issues

Emoji-commit always overwrite commit message (.git/COMMIT_EDITMSG)

Background
When emoji-commit receives the path .git/COMMIT_EDITMSG it assumes that the file is empty and it will initialize a new commit message by displaying the emoji-picker. This is the typical and desired behavior when invoking git commit. This will overwrite the content of .git/COMMIT_EDITMSG .

Issue
I have found some cases where emoji-commit will receive .git/COMMIT_EDITMSG and it is not desired to overwrite the content of .git/COMMIT_EDITMSG.

  1. After doing a git pull --rebase that results in one or more conflicts, the final step of resolving those conflicts are by running git rebase --continue. Git wants to give the user the option to edit the commit message (as documented in https://git-scm.com/docs/git-rebase#_commit_rewording) which results in .git/COMMIT_EDITMSG being sent to emoji-commit.
  2. After running git rebase --interactive and selecting reword on one or more commits, the previous message will be written to .git/COMMIT_EDITMSG and provided to emoji-commit.
  3. When running git commit --amend.

Solution
I propose that we solve this by checking if the git message is empty (either each line is empty or starts with a #) before displaying the emoji-picker. If the message is empty we proceed as always and show the emoji-picker. Otherwise we launch the default editor with the given path, which will give the user the option to edit or keep the current message. I will create a PR with a solution proposal.

macOS High Sierra rendering issue

screen shot 2017-08-01 at 16 36 35

I think that the problem is that I before assumed that every emoji would take up to chars, but only advance the cursor by one, so I always printed a space after each emoji. Behaviour should somehow be detected and then it should do the right thing...

Add --stable to commit with πŸ—Ώ

I think the title says it all! I could PR this, just want to put an issue to discuss if --stable is a good solution.

As it will only be used once per project, I don't think having it always show in the list is a good idea.

Option to choose commit type

Instead to choose the commit type from the list, is it possible to pass the commit type by argument?

E.g.

$ emoji-commit -b     # -b could mean "Bugfix"

- πŸ› [Write message here]

As well, the message? E.g.

$ emoji-commit -b -m "Fixed this bug"

Option to add commit body text

It would be nice if emoji-commit allowed you to add a commit body text too, the way I imagine it, after entering the short commit message, you'd press alt/shift+enter and open your $EDITOR on the correct line.

To open the editor on the correct line, we will need a separate rust lib to handle the different ways editors enable this, for example, this is how you do it i VS Code

How to use without cargo?

I'm curious to try this thing, but I don't use Rust/cargo. Do you plan to have an npm package? πŸ˜‰

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.