ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Git​Auto​Commit

by anjlab ST2/ST3

Enables auto-commit for selected Git repos (install Git plugin first)

Details

Installs

  • Total 2K
  • Win 1K
  • OS X 536
  • Linux 473
Aug 18 Aug 17 Aug 16 Aug 15 Aug 14 Aug 13 Aug 12 Aug 11 Aug 10 Aug 9 Aug 8 Aug 7 Aug 6 Aug 5 Aug 4 Aug 3 Aug 2 Aug 1 Jul 31 Jul 30 Jul 29 Jul 28 Jul 27 Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4
Windows 1 1 0 1 2 1 1 2 1 1 1 3 0 0 1 1 1 1 1 1 0 0 2 1 2 1 0 2 1 3 1 0 2 0 2 1 1 1 1 2 0 0 0 0 1 2
OS X 0 2 1 2 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 2 0 0 0 0 1 0 1 0 0 1 0 1 2 0 0 0 0 0 0 0 0 0
Linux 0 0 1 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 2 0 2 0 1 0 2 1 1 0 1 1 1 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1

Readme

Source
raw.​githubusercontent.​com

Installation

  1. Install Package Control if you don't have it yet
  2. Install Git plugin (required)
Shift + CMD + P -> Install Package -> Git
  1. Install GitAutoCommit
Shift + CMD + P -> Install Package -> GitAutoCommit

Why auto-committing anything at all?

I like using Sublime Text as a buffer for:

  • working with text from clipboard,
  • or writing random notes in the way only I can understand

Such notes usually change a lot during a day, and I often need to find a piece of text I had in there.

This little plugin helps tracking a history of such notes automatically. It stores the history in a Git repo.

How it works?

You create new Git repo for your notes with an empty file .sublime-text-git-autocommit. This way plugin knows that it should enable auto-commits for files in this repo.

Changes committed when you either: * saved a file in your Git repo, * or after you made changes to the files (in a 30 seconds delay).

Every changed file added & committed separately with commit message like:

Auto-committing 'TODO.txt'

How to use?

  1. Create new Git repository for your temporary files
mkdir ~/Documents/Notes
cd ~/Documents/Notes
git init
  1. Add empty file with name .sublime-text-git-autocommit to the root folder to activate this plugin
touch .sublime-text-git-autocommit
git commit -am "Commit .sublime-text-git-autocommit"
  1. Create one or more text files at the same folder and make your notes in them
touch TODO
touch Clipboard
  1. All changes made via Sublime to these files will be committed automatically (nested folders ignored)

How to view history?

Use git log -p.

Or publish your repo as GitHub Gist and use its diff viewer.

To publish as GitHub Gist:

  1. Create new private Gist
  2. Copy git clone URL
  3. From the root folder of your git repo
git remote add origin https://gist.github.com/YOUR_GIST_ID_HERE.git
git remote -v
git branch --set-upstream-to=origin/master master
git pull
  1. Push your changes to Gist manually from time-to-time

“Shift+CMD+P” -> type “Git Push” -> Enter 5. View diffs on GitHub

GitHub 2FA

If you enabled GitHub's 2-Factor Authentication then you need to use access token to push to your Gist repo from command line.

I found Gist Tool helpful for this purpose.

brew install gist
gist --login
cat ~/.gist

Once you have your access token use it as a username when GitHub asks for credentials, leave password empty.

License

MIT-License

How to contribute?

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create New Pull Request