Git is a very popular version control system and Sublime Text is very popular text editor tool. If you are new to sublime text editor then I recommend you to read Sublime Text Plugins, Tips and Settings. This post explains step by step on how to use Git plugin into Sublime Text editor to increase development productivity.
There are many plugins available in package control for Git integration in sublime text. My personal favourite is Git, which I am going to discuss in this post.
Install Github on Your Machine
If you have already installed Github on your machine then you can ignore this step and proceed forward to read on next step. Download Github from Here and install it on your machine. After successful installation open command prompt on your windows machine Or terminal on your mac machine and type
git to make sure github is installed successfully on your machine. This will ensure that path of github executable is inside your environment variable.
Install Git Plugin in Sublime Text
In your text editor, open package installer using
Cmd + Shift + P on Mac or
Ctrl + Shift + P on windows. Go to
Install Package -> Git .
After successful installation, your can access commands of Git plugin using
Cmd + Shift + P on mac and
Ctrl + Shift + P on windows machine and type
Git: . This will show all git commands as shown in the below image.
Git: Init > Initialize Current Directory as Git Directory
Git : Init to initialize your working directory as Git repository.
Git: Add All > Add files to staging area
Git : Add All to add all changed files to staging area.
Git : Add Current File to add only current file into staging area.
Git: Commit > Add staged files to commit area
Git: Commit to add all staged files to commit area. It will promt another page to add commit message. This page will show all code hunks that will be part of this commit. Add a commit message and close the file to commit files.
Git: Push > Push Changes to remote origin
Git: Push will push your local committed changes to associated remote repository. This command will give error in sublime console if remote repository is not associated with local repo.
Git: Pull > Pull changes from remote orign
Git: Pull will pull remote repo changes and merge it into local repository.
Git: Diff All Files > Show differences which are not committed
Git: Diff All Files will show all changes in the code which are not committed. This will open up new window which is showing all the changes in the code hunks.
Git: Log All > Check log of changes in specific commit
Git: Log All will prompt to select the list of previous commit. Once you select specific commit, it will show log of all changes happened in that commit.
This post explains very basic operations of Github in sublime text. You can explore other option in git plugin as per your need.