How to integrate Sublime Text with GitHub?

I thought it would be perfect if ST would have a plugin for syncing repo with the one on GitHub account, but I can't find such a thing.

There is Github Tools and sublime-github but they don't provide commit or push commands.

I can always use GitHub's app for syncing but plugin is more convenient, since it can be assigned to ST's hotkeys.

Answers


There are numerous git plugins available via Package Control, so all you have to do is browse through them, read the READMEs, and decide if you want to try it out. I use SideBarGit (along with SideBarEnhancements), which allows you to right-click on a file in your project and get access to the whole array of git-related tasks, from Add & Commit & Push to Branch to Clone to Diff and more. Another popular tool is Git, which provides essentially the same options as SideBarGit, just in a menu off Tools instead.

SublimeGit is a free-to-try, € 10 to buy commercial plugin (available through Package Control) that looks like it's very full-featured, allowing you to do just about anything related to git. It includes a number of syntax definitions for editing commit messages, looking at diffs, comparing branches, etc., and judging by its popularity (it's one of the Top 100 at Package Control) a lot of people seem to like it. But, it's not open-source, and costs extra money to use long-term.

Any of these will work with Github, Bitbucket, or any other public or private repo that uses the git protocol. Try them out, and see what works for you.


13 March 2019 - SublimeMerge was released

You can use SublimeMerge, which was created by the same people, who wrote SublimeText - so you can expect compatibility and updates as long as SublimeText is as popular as it is.

SublimeText version 3.2 has GitIntegration as a new feature. Here is some details from changelog:

  • Files and folders in the sidebar will now display badges to indicate Git status
  • Ignored files and folders are visually de-emphasized
  • The current Git branch and number of modifications is displayed in the status bar
  • Commands have been added to open a repository, see file or folder history, or blame a file in Sublime Merge
  • Themes may customize the display of sidebar badges and status bar information
  • The setting show_git_status allows disabling Git integration
  • All file reads are done through a custom, high-performance Git library written for Sublime Merge
  • Read the documentation

Via Package Control, you can install sublime-github. It's simple and works fine for me.


All you need are the extensions 'Git', 'Git Gutter', and 'Sublimerge'

Git: I use it to open git gui and perform all the other git operations right inside Sublime Text.

Git Gutter I use this to display the new changes that are not committed yet on the current working file.

Sublimerge I use this to compare the current working file with any previous revisions of the same file


In addition to using Sublime Merge, mentioned above, you can invoke it directly with git difftool now.

With Git 2.22 (Q2 2019), that will be easier, since the configuration will be done for you, and "git mergetool" learned to offer Sublime Merge (smerge) as one of its backends.

As commented in SublimeTextIssues/Merge issue 19:

Usage:

git config --global merge.tool smerge 

and then just git mergetool or git difftool.

See commit f57b2ae, commit eb12adc (04 Apr 2019) by David Aguilar (davvid). (Merged by Junio C Hamano -- gitster -- in commit 5116eab, 22 Apr 2019)

mergetools: add support for smerge (Sublime Merge)

Teach difftool and mergetool about the Sublime Merge "smerge" command.

Git now has a mergetools/smerge file with:

diff_cmd () {
    "$merge_tool_path" mergetool "$LOCAL" "$REMOTE" -o "$MERGED"
}

merge_cmd () {
    if $base_present
    then
        "$merge_tool_path" mergetool "$BASE" "$LOCAL" "$REMOTE" -o "$MERGED"
    else
        "$merge_tool_path" mergetool "$LOCAL" "$REMOTE" -o "$MERGED"
    fi
}

Again: the configuration is done for you.


Need Your Help

CSS combinator precedence?

css css-selectors

Is there a precedence to combinators like

Check if bash script was invoked from a shell or another script/application

bash scripting shell redirect

I am writing a bash script to redirect output from another command to the proper location. Basically, when the script is invoked from a shell/commandline I want to send the output to STDOUT. But, w...