Now we are heading into our fourth post about sublime. So far we have looked at why we might want to use sublime. We have installed sublime and learned some basic key shortcuts and we have installed a package manager with our first package. In this post we will install git integration into sublime and look at how its used.
This post assumes that the code you have opened in sublime is in a git repository!
So let’s start by installing the git package.
Hit ctrl+shift+p (you should be good at this)
Type install wait for 2-3 seconds
Type git and hit enter to install https://github.com/kemayo/sublime-text-git/wiki
After a few moments the git plugin will be installed. You may or may not need to restart sublime at this point I have heard mixed results.
Now let’s try using our git plugin. Let’s start by being in a file under source control and hitting
ctrl+shift+p git log
You will see the full log of your code. If you select one you can view the commit in a text window.
Let’s try another common one
ctrl+shift+p git pull
This will do a git pull. This is just the very beginning of the integration though. One of my favorite features. Add a new file foo.cs. Then in that file do a
ctrl+shift+p git add (current file)
if you then do a ctrl+shift+p git status you can see that the file has been added. We can also add such fun functionality as ctrl+shift+p blame :)
When you want to commit:
ctrl+shift+p git commit
this will bring up a buffer of your commit. Just type it your comment and hit ctrl+w to close the window and commit.
This plugin has very deep git integration including diff viewing and annotating code while working in it! You can find more on its feature set here https://github.com/kemayo/sublime-text-git/wiki
It takes a bit of exploring but you can do quite a bit with git integration in sublime and its language agnostic which is really nice.
While we are on the topic let’s install the github plugin since many of you are probably using github. The package is sublime-github https://github.com/bgreenlee/sublime-github. You can read more about the configuration of the plugin on their website but it allows you to do things like
view on github (opens code in browser)
manage gists (eg file or selection to public gist)
Overall its quite well done as well.
So now you have gotten full git and github integration into sublime very soon we will start getting into the C# specific stuff but before that we need some better linux specific handling.