This tutorial is out of date and no longer maintained.
Improving workflow and increasing productivity is very important to us developers. Every second counts since the time we spend on small tasks add up. Small tasks like our Git commands are something that we do on a daily basis. Today we’ll be looking at a quick way to improve our Git workflow with our favorite editor,
Sublime Text. Here’s a quick example of how fast Git works within Sublime Text.
Let’s run through the things we’ll need to improve our Git workflow real quick.
Git Installation for Windows User: When installing Git, make sure you select Run Git from the Windows Command Prompt. Everything else can be default settings.
Usually, when I am working in Sublime Text and want to commit some changes, I will switch over to my terminal window and type the following:
- git add -A
- git commit -m 'Documenting the change made to the files.'
- git push
While this is easy enough, let’s cut a few seconds off our workflow and do this within Sublime Text.
After installing the Git package, if you open your command palette by using
Then, you’ll see your available Git commands.
The cool thing is that like all other times you use the command palette, you don’t have to enter the entire command. Sublime Text will autocomplete things for you. So instead of typing
git add -A
You can just type:
And Sublime Text will know! Just another way to shave off milliseconds off your workflow.
You will notice that there are two commit commands the Sublime Text Git Plugin provides. The main difference is that Quick Commit will open up a little text box that you can quickly type into while Commit will open a new file and show you the changes in each file. Here’s Quick Commit in action:
Here’s Commit in action:
Just close the file after using
Commit and it will use the message you typed as the commit message!
My workflow when trying to push code to the server inside of Sublime Text looks like:
Staging Files and Committing In One Step: To add and commit all in one step, just skip straight to the
Quick Commit command. That will stage and commit for you. It’s the equivalent of
git commit -am 'im staging and committing!'. Thanks to Moran Bentzur for the tip in the comments.
There’s so much more you can do with this plugin.
Git Gutter Another cool Git Sublime Text package to use is Git Gutter. It will add icons to the text editor to show which lines have been added or removed in the latest commit.
Try out this workflow and see if you find that it saves you some time. With a quick addition of a Sublime Text package, we’re able to add a ton of functionality into our favorite text editor. There are many more things you can do with this plugin including branching, rebasing, stashing, and more. It’s very fully featured and I definitely encourage all to check it out. For more plugins, here.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in our Questions & Answers section, find tutorials and tools that will help you grow as a developer and scale your project or business, and subscribe to topics of interest.Sign up