Gedit is a very basic but sufficient text editor for many purposes. Following the best practice to commit early and often can be cumbersome since one have to switch to the terminal in order to add file, commit changes, and push everything to the remote repository. To easy this process commiting should be as easy as saving a file.
By the help of the gedit plugin “External Tool” we can manage with a few lines of code. Since we need to specify changes together with every commit zenity gives us the chance to enter some text before commiting the code.
git add .
inputStr=$(zenity --entry --title="Commit Message" --text="Enter a commit message" --entry-text "minor updates")
git commit -m "$inputStr"
git push origin master
If you put this snipped as an application into the External Tool plugin you can call the script by a simple keyboard command, e.g. str + g
Now you can call the script even from files that are nested inside your repository folders.
One thought to “Using gedit to commit and push to GitHub by a simple keyboard shortcut”
Still works in Gedit 3.34.0. Thanks.