Configure git inside of sublime text editor windows

Folks,

Lets see the configuration process that needs to be done in order to work with git commands in sublime text editor for workflow..

Prerequisites are

1. Git (command prompt only) – http://git-scm.com/docs

2. Sublime text editor

3. Sublime git package (refer https://sublimegit.net/#installation)

I hope with this you installed git and configured path in environment variables too..

Its better refer this url before you go with installation..

Now lets begin the show.. 😉

Steps:

I am directly moving to the configuration hoping you set the path for git and nodejs in environment variables which includes npm path in AppData too. Now run command prompt..

1. git config –global core.editor “‘c:/program files/sublime text 2/sublime_text.exe’ -w”

With this you can view .gitconfig file in C:/Users/username/ which should be as follows

gitconfig file:

[user]
name = sathya
email = sathya.vakacharla@gmail.com
[core]
editor = ‘C:\\program files\\sublime text 2\\sublime_text.exe’ -w

You can test it by app.js –edit in command prompt like

c:/project/folder/app.js > app.js –edit

this will open app.js file in sublime text editor

2. Now create a folder named sublimegit and extract sublimegit package in to C:\Users\username\AppData\Roaming\Sublime Text 2\Packages\SublimeGit

3. Now restart your sublime text editor

4. Now check your git commands in editor by going to command palette(ctrl+shft+p) and type add/push etc to show up with commands like git:Add etc.

e95969b07ac68c91eacba39d8c30543e727f06d02233-sathya

5. How to add and commit and push to your remote git repository..

after changing necessary code in app.js..just goto command palette and type/choose “git add current file” then followed by “git quick commit” and “git push”

How to find the differences in versions of your files when you pull from git repository..

Sublime Text’s Git package offers several useful diff options, all available from the Command Palette (control+shift+p).

  • “Git: Diff Current File”, which presents a diff of the current file and the last commit
  • “Git: Diff “, which presents a diff of all files in your repository the last commit.

The diff will open up in a new file tab within Sublime Text. What’s nice is that there is syntax highlighting which helps you identify the additions and deletions.

st-git-diff-sathya

Wanna view log??

Just type and select “Git: Quick Log” in command palette to view the latest log for the whole repository.

Blame:

Get an annotated version of the entire current file.
Commit
After adding files, commit them all with a message. (Close the file without saving it to commit)
Quick Commit
Add and commit the current file, after asking for a message.

Status:

Show the status of the repo. Chosing a file gives you a diff of it.

Refer Git Commands for sublime text editor here

Useful commands:

to clone from git repository or any shared path:

git clone git://git.kernel.org/pub/scm/.../linux.git my-linux

to check username/email/etc

git config --list

More Package control repositories for sublime text editor https://packagecontrol.io/

Useful links: https://github.com/kemayo/sublime-text-git/wiki

http://plaintext-productivity.net/2-08-how-to-set-up-git-and-sublime-text-for-version-control.html

git-cheat-sheet-education

Advertisements

One thought on “Configure git inside of sublime text editor windows

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s