Git Product home page Git Product logo

commit's Introduction

Commit

Commit is an editor that helps you write better Git and Mercurial commit messages.

screenshot

https://apps.gnome.org/Commit

Download on Flathub

Installation

Setup flatpak then

flatpak install re.sonny.Commit
flatpak run re.sonny.Commit # Follow instructions

Tips and trick

Emojis

right-click ➞ Insert Emoji or use the shortcut Ctrl+. πŸŽ‰οΈ The Emoji picker works in any GNOME app πŸ‘£οΈ

Open Commit in the center of the screen

On GNOME you can make all new windows open in the center using

gsettings set org.gnome.mutter center-new-windows true

See https://gitlab.gnome.org/GNOME/mutter/-/issues/246

or set and use the move-to-center keybinding

gsettings set org.gnome.desktop.wm.keybindings move-to-center "['<Super><Control><Shift>Space']"

Translation

If you'd like to help translating Commit into your language, please head over to Weblate.

Translation status

Thank you for your help!

Development

cd Commit
git submodule update --init --recursive
./src/local.js --readonly test/fixtures/with-body/COMMIT_EDITMSG

Make changes and hit Ctrl+Shift+Q on the Commit window to restart it.

To pass the tests you have to install a few dependencies

# Install development dependencies
sudo dnf install --assumeyes npm flatpak make desktop-file-utils gjs gtk4-devel libadwaita
npm install
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --user --assumeyes --noninteractive flathub org.freedesktop.appstream-glib

# Run tests
make test

Flathub builds https://flathub.org/builds/#/apps/re.sonny.Commit

Maintainer

i18n
# To update the pot file
# xgettext -f po/POTFILES -o po/re.sonny.Commit.pot --no-wrap -cTRANSLATORS --from-code=UTF-8
# sed -i "s/Project-Id-Version: PACKAGE VERSION/Project-Id-Version: re.sonny.Commit/" po/re.sonny.Commit.pot
meson compile re.sonny.Commit-pot -C _build


# To create a translation
# msginit -i po/re.sonny.Commit.pot -o po/fr.po -l fr_FR.UTF-8
echo -n " fr" >> po/LINGUAS
meson compile re.sonny.Commit-update-po -C _build

# To update translations
# msgmerge -U po/*.po po/re.sonny.Commit.pot
meson compile re.sonny.Commit-update-po -C _build

See #14 (comment)

Publish new version
  • meson compile re.sonny.Commit-update-po -C _build
  • Update version in meson.build
  • git tag
  • flathub

Building

host
cd Commit
meson --prefix $PWD/install build
ninja -C build install
Flatpak

Use GNOME Builder or

cd Commit
flatpak-builder --user --force-clean --repo=repo --install-deps-from=flathub flatpak re.sonny.Commit.json
flatpak --user remote-add --no-gpg-verify --if-not-exists Commit repo
flatpak --user install --reinstall --assumeyes Commit re.sonny.Commit

Credits

Commit is a fork of Gnomit wich was inspired by Komet.

Many thanks to its original author Aral Balkan of Small Technology Foundation.

Contributors

Copyright

License

GPLv3 or later. Please see COPYING file.

commit's People

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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

commit's Issues

Needs a menu button

Now that we have a shortcuts window and preferences, it may be good to make them accessible from the main window.

Unfortunately the header bar is a bit crowded.

Screenshot from 2021-10-17 23-49-55

I can think of a few options

  1. Use the global app menu (in the top GNOME shell top bar ) but it's kinda deprecated and hard to discover
  2. Put the menu button regardless
  3. Use a GtkMenuButton as the header bar title but it's a bit odd given the title isn't the name of the app but meta information about the current action - ${type}: ${projectDirectoryName} (${detail})
  4. Use a "classic" header bar and move the Cancel and Commit buttons on the bottom - probably in a ActionBar

@bertob any thoughts?

Double border on text view

The text view where the commit message is entered seems to have a double border:

image

It's especially noticeable in high contrast:

image

Add maintainer info for Apps for GNOME

For the maintainer to appear in Apps for gnome it must contain info about the git forge account

  <maintainer>
    <foaf:Person>
      <foaf:name>User Name</foaf:name>
      <foaf:mbox rdf:resource="mailto:[email protected]" />
      <gnome:userid>gnome-user-acc</gnome:userid>
      <foaf:account>
        <foaf:OnlineAccount>
            <foaf:accountServiceHomepage rdf:resource="https://github.com/"/>
            <foaf:accountName>user-github-acc</foaf:accountName>
        </foaf:OnlineAccount>
      </foaf:account>
    </foaf:Person>
  </maintainer>

Reduce maximum message length

Right now, I can increase the maximum title and body length of the commit above 50 and 72 respectively, but I'm not allowed to reduce it beyond that amount. I normally limit my message to I think about 60 characters, so it would be useful if Commit allowed me to tune this maximum down.

Screenshot from 2022-07-04 15-23-14

Is there any particular reason there's a minimum at all? Otherwise why not let it run to zero and let the user figure it out? πŸ˜‰

Syntax hightlighting for interactive rebase

This is a nice feature that I miss from the Kate editor on KDE. When doing interactive rebase the action, hash and commit message are highlighted in different colors. It's a simple quality of life improvement. Here's a quick mock-up (with example colors):
image

Prior art in Kate text editor:
image

Show translated app-text on webpages

If you can, please check why the descriptive/summary texts for the Commit app don’t show translated on different pages (see below). If possible, please implement it.
I’m not a programmer, so I can’t help you out unfortunately :-(

https://world.pages.gitlab.gnome.org/apps-for-gnome/hr/

https://world.pages.gitlab.gnome.org/apps-for-gnome/hr/app/re.sonny.Commit/

https://apps.gnome.org/app/re.sonny.Commit/ (also missing the last section on translation status)

https://flathub.org/apps/details/re.sonny.Commit

New icon?

The current icon isn't quite in line with the guidelines, would you like help with a new one?

I took a quick stab at it, how about something like this?

image

Unable to add a message to an existing tag

Creating a tag and later trying to add a message to it, it fails (Commit window doesn't open, it just prints the error message):

$ git tag test-tag 
$ git tag test-tag -a -f
hint: Waiting for your editor to close the file... 
(re.sonny.Commit:2): Gjs-CRITICAL **: 20:38:19.094: JS ERROR: TypeError: commentLines[3] is undefined
parse@file:///app/share/re.sonny.Commit/scm.js:38:21
openEditor@file:///app/share/re.sonny.Commit/application.js:104:12
Application/<@file:///app/share/re.sonny.Commit/application.js:35:15
main@file:///app/share/re.sonny.Commit/main.js:51:22
@file:///app/bin/re.sonny.Commit:12:5

fatal: no tag message?

If I create a tag with a message and later try to change it, it also fails. The only difference is in the last line:

$ git tag test-tag -a
$ git tag test-tag -a -f
hint: Waiting for your editor to close the file... 
(re.sonny.Commit:2): Gjs-CRITICAL **: 20:38:49.572: JS ERROR: TypeError: commentLines[3] is undefined
parse@file:///app/share/re.sonny.Commit/scm.js:38:21
openEditor@file:///app/share/re.sonny.Commit/application.js:104:12
Application/<@file:///app/share/re.sonny.Commit/application.js:35:15
main@file:///app/share/re.sonny.Commit/main.js:51:22
@file:///app/bin/re.sonny.Commit:12:5

Updated tag 'test-tag' (was 37ac31b)

If I remove the editor = flatpak run --file-forwarding re.sonny.Commit @@ line in .gitconfig, both scenarios work properly and add/change the tag message.

Minor: the artist previously known as balkan

Hey Sonny,

Congrats on the work you’re doing on Commit and on supporting it in GNOME circles. Sorry I was slow to reply to your messages; had other things on – happy you ran with it as I’m focussing any limited time I have left over from the Small Web work on elementary OS-specific stuff. So it’s nice to see this available for the wider community.

One request: could you capitalise my last name in the README, etc.? (Aral Balkan, not Aral balkan.) Not a biggie, I just don’t want people to think I use some weird stylised way of writing it :)

Looking forward to seeing where you take it and keep your eyes peeled for something specific to elementary OS in the near future from me ;)

Take care + πŸ’•

rfc: Add dedicated rebase UI?

Unlike commits, the todo list of an interactive rebase is not free-form. We could therefore do better than just popping up an editor like git does, and instead have a dedicated UI:

Screenshot from 2022-08-11 17-10-34

Does that look like a good idea?

(I'm about to go on holiday, so may have some time for some fun hacking)

Limit width of TextView

Follow up from #56

I've been experimenting with setting the TextView width to the desired max body length.
The benefit is that if you make Commit window bigger you can see what the text will wrap.
It would probably be a max with thought or making the window smaller / mobile device will have a scrolled area.

An other option would be to make the Window big enough to fit the textview - only if the screen is wider than the width of course.

The TextView should be centered too.

We can also add a ruler.

Something like this seems to work well - tested in Workbench

import Pango from "gi://Pango";

const textview = workbench.builder.get_object("textview");
const metrics = textview.get_pango_context()?.get_metrics(null, null);
const text =
  "foo sdfs fas fas df as dfa sdf sdf sd fs ldflasd falsdfkasdf kasdfk asdlkfask dflaksd fkals dfk asdkfl asdklf aslkd f dsf flkasd flskd flaksd faslkd f ";
textview.get_buffer().text = text;

const max_body_length = 75;
const character_width = metrics.get_approximate_char_width() / Pango.SCALE;

const total_width =
  character_width * max_body_length +
  1 +
  textview.right_margin +
  textview.left_margin;

textview.width_request = Math.ceil(total_width);
<?xml version="1.0" encoding="UTF-8" ?>
<interface>
  <object class="GtkBox" id="welcome">
    <property name="orientation">vertical</property>
    <property name="hexpand">true</property>
    <property name="vexpand">true</property>
    <child>
      <object class="GtkTextView" id="textview">
        <property name="left-margin">0</property>
        <property name="right-margin">0</property>
        <property name="halign">start</property>
        <property name="monospace">true</property>
        <property name="hexpand">true</property>
        <property name="vexpand">true</property>
        <property name="wrap-mode">word-char</property>
      </object>
    </child>
  </object>
</interface>

Move preferences

Are more preferences planned? Currently there's a single option in the preferences dialog, which looks a bit weird.

https://gitlab.gnome.org/Teams/Circle/-/issues/83#note_1257600

For now there will be only one preference. I imagine 1 or 2 more in the future.

I see 2 options

  1. Move preferences to this window (maybe at the top with a section named "Preferences")

Screenshot from 2021-09-12 11-34-44

  1. Move preferences to the menu popup of that same window

Screenshot from 2021-09-12 11-59-43

@bertob do you think the first option makes sense?

Move instruction comments to a separate sourceview

Git adds instructions in the form of a block comment at the end of the file, for example

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Your branch is up-to-date with 'origin/master'.
#
# Changes to be committed:
#	modified:   README.md
#

right now we make this readonly and exclude it from select all.

Since it's not deletable anyway, let's move it to its own readonly gtksourceview to remove readonly/select-all code and simplify

We can also do like https://github.com/small-tech/comet/ and move it a a GtkText

JS ERROR: too much recursion

AUR package maintainer here. When running git commit to spawn Commit, the following is spammed in the terminal:

(re.sonny.Commit:303277): Gjs-CRITICAL **: 17:03:11.736: JS ERROR: too much recursion
validateCommitButton@file:///usr/share/re.sonny.Commit/validateCommitButton.js:8:29
Editor/<@file:///usr/share/re.sonny.Commit/editor.js:141:25
Editor/<@file:///usr/share/re.sonny.Commit/editor.js:105:14
Editor/<@file:///usr/share/re.sonny.Commit/editor.js:105:14
Editor/<@file:///usr/share/re.sonny.Commit/editor.js:105:14
 ...

The last repeated 4 lines repeat over and over

Insert hard newlines instead of wrapping long lines

Commit should not put the entire commit message on as few lines as possible: it makes reading commit messages harder than necessary on the command line.

If the user specifies a hard limit for the length of each line, the commit message should be following that size. This should be possible by iterating over the text using Pango, and finding where words wrap.

[Help] Start under zsh raises an error (using wayland on fedora 36)

Hello.
Open Commit inside an bash terminar or even from Gnome menu is ok, but when i try to open from zsh shell (using ohmyzsh) Commit screen wont open:

➜  Docs flatpak run re.sonny.Commit

(re.sonny.Commit:2): Gtk-WARNING **: 12:36:35.606: cannot open display: 
➜  Docs

I've tried everything i now to make this open, but no success

(The same has happend when i tried to open from vscode terminal too)

Make it show previous commits

Would be nice if it could show the last commits. Sometimes you need to see what you wrote in previous ones. And it would be very nice if the previous commits could be changed as well.

Thats what i miss when i enter commit "stories".

Default focus

From a UX perspective, wouldn't it make more sense to have the text focused? Users can cancel with Esc; We could also add a shortcut for Ctrl+Enter. For tab navigation there's Ctrl+Tab.

For most cases Commit wouldn't be sensitive, so it's redundant to give Cancel focus.

Originally posted by @BrainBlasted in #30 (comment)

Confirm or save commit message when "escape" is pressed

First, thanks for the great app! It's very well done 😁

Only one thing is bugging me: once in a while, my muscle memory hits the "escape" key when I'm done typing my commit message (maybe because I'm used to Jetbrains IDEs and that puts my cursor back in the main editing panel? Unsure why). Unfortunately, with this Commit app, it cancels the commit and throws away my message, which hurts my feelings πŸ˜”

I have two potential behaviour suggestions that could help with this sharp edge:

  1. If the message text field has been modified, show a "confirm" dialog if the user tries to abort. This is a simple solution, but it can cause "confirmation fatigue" where people are annoyed by it and start to ignore it, so I trust your judgement here, however you lean.
  2. A more complex solution could be to save the in-progress message to disk if the commit is canceled out. Then, on the user's next commit, re-use that last message that they had before. Perhaps the "message re-use" could even be conditional based on whether it's the same repository. I think this is the more ergonomic solution, but I'm interested in your thoughts.

Thanks again, and I hope you have a good holiday season πŸ‘‹

Closing the about page with escape closing the hole window

Current behaviour
If you open the about page and hit escape it closes the hole app. Pressing alt+F4 or pressing the close button works like expected.

Expected behaviour
It should only close the about page without the main window

Used latest version on flathub: 2.2.0

Issues editing `~/.gitconfig`

  1. in terminal, run git config --global core.editor "flatpak run --file-forwarding re.sonny.Commit @@"
  2. in terminal, run git config --global -e. It'll open the Commit window and print this message in terminal:
hint: Waiting for your editor to close the file... Warning: unknown commit type encountered in: /run/user/1000/doc/ab12bc58/.gitconfig
  1. pressing Abort will delete all contents in .gitconfig, leaving the user with an empty file
  2. however, if I don't abort and try to make some changes to .gitconfig, I'm unable to as existing content is read-only, and I'm only able to insert content at the start of the file or append it at the end of the file

New name?

As discussed in the Circle issue my feeling is the current name is not terrible but a bit too generic. Something with a bit more personality would be nicer.

Some ideas to get the ball rolling:

  • Savepoint
  • Checkpoint
  • Commitment
  • Snapshot

Flat headerbar

Depends on #30

Does it make sense for Commit to use a flat header bar? I kinda like the third option.

cc @bertob @BrainBlasted wdyt?

default
Screenshot from 2021-09-23 18-09-15

flat

Screenshot from 2021-09-23 18-09-31

flat - same color as content

Screenshot from 2021-09-23 18-49-08

Don't auto uppercase first letter

Currently whenever I update a commit message, the application auto uppercase the first letter which is not really a desired behaviour. Would it be possible to completely disable that or at least make it optional?

run on wayland

"flatpak run --socket=wayland --env=GDK_BACKEND=wayland --file-forwarding re.sonny.Commit @@"
fedora 35

Smarter capitalization

foo: bar -> capitalize Bar
foo bar -> capitalize Foo

foo: is a tag and shouldn't be capitalized

button_save.set_sensitive(false) is not enough

Hi, you have a bit of code which sets the button_save sensitive property to false when the commit message is empty but the "win.save" action remains enabled can be activate via the shortcut.

Which is probably wrong.
Cheers

Keybindings for moving lines up and down

Shuffling lines up and down is a frequent operation when doing interactive rebase. A pair of key bindings to do that would be great. I'd suggest Alt + Up/Down to match gedit.

Not triggered by 'git commit'

Continuing from Reddit...

PKGBUILD

Installed files:

❯ pacman -Ql commit
commit /usr/
commit /usr/bin/
commit /usr/bin/re.sonny.Commit
commit /usr/share/
commit /usr/share/appdata/
commit /usr/share/appdata/re.sonny.Commit.appdata.xml
commit /usr/share/applications/
commit /usr/share/applications/re.sonny.Commit.desktop
commit /usr/share/glib-2.0/
commit /usr/share/glib-2.0/schemas/
commit /usr/share/glib-2.0/schemas/re.sonny.Commit.gschema.xml
commit /usr/share/icons/
commit /usr/share/icons/hicolor/
commit /usr/share/icons/hicolor/scalable/
commit /usr/share/icons/hicolor/scalable/apps/
commit /usr/share/icons/hicolor/scalable/apps/re.sonny.Commit.svg
commit /usr/share/re.sonny.Commit/
commit /usr/share/re.sonny.Commit/about.js
commit /usr/share/re.sonny.Commit/application.css
commit /usr/share/re.sonny.Commit/application.js
commit /usr/share/re.sonny.Commit/editor.js
commit /usr/share/re.sonny.Commit/main.js
commit /usr/share/re.sonny.Commit/meson.build
commit /usr/share/re.sonny.Commit/re.sonny.Commit
commit /usr/share/re.sonny.Commit/scm.js
commit /usr/share/re.sonny.Commit/setup.js
commit /usr/share/re.sonny.Commit/util.js
commit /usr/share/re.sonny.Commit/validateCommitButton.js
commit /usr/share/re.sonny.Commit/welcome.js
commit /usr/share/re.sonny.Commit/welcome.ui
commit /usr/share/re.sonny.Commit/window.js
commit /usr/share/re.sonny.Commit/window.ui
❯ git --version
git version 2.31.1

The output of git commit complains if there's nothing to commit or commits as expected.

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.