vytfla February 2016

Installing and using Git with Sublime Text 2

I'm new to git and following a tutorial and want to use it with Sublime Text 2. I installed the Git package, and the tut says that if I open the command palette (ctrl+shift+p) I will be able to see all the git commands, but I only see Git: Init and Git: Commit history. Do I first have to go into my repository/folder? If so, how would I do that? Right now I am on a new file which I assume is why I can't see any Git commands.

Also, I want to make SB2 my default editor, and I tried this code in my command line (using git bash). Is anything supposed to happen? How do I know if it worked? And what if I wanted to revert back to the command line (git bash) instead of SB2?

Answers


Cad February 2016

To answer the first part, you can do this by opening the folder in SB2:

  1. File -> Open Folder...
  2. Open your local git repository (The directory where the .git file is located)
  3. Commands like 'Git: Add all' should be available via cntrl+shift+p

To answer the second part, the code you entered is for when you want to use git bash as your git client. This code will set up SB2 as your text editor for git bash. If it worked, the next time you make a commit in git bash, just type 'git commit' and SublimeText2 should open up, to where you can enter your commit message.

If you need to revert back your core.editor to default, look at the following: Git: How can I reset a config parameter after I have accidentally changed it?

To try and answer your comment,
What's the difference between git bash and the git plugin for SB2?
They are just different ways to interact with git and git repositories. Thus you would use the SB2 plugin as a replacement for git bash. This means you would be doing all the git commands (git add, git commit, etc) via the command palette in SB2, rather than as a command line via git bash(and thus no, you would not have to always start with git bash until you 'git commit'). If you wanted to use the git plugin for SB2, you wouldn't need to make SB2 your default editor for git bash(second part) as the plugin will always use SB2 for this purpose.

If you want to interact with git via git bash instead of the SB2 plugin, you would not need to install the git plugin on SB2. To give some background information, by default Git Bash usually uses a command line text editor(VI or VIM(https://en.wikipedia.org/wiki/Vim_(text_editor))). Git Bash will then use this text editor(VIM for

Post Status

Asked in February 2016
Viewed 2,227 times
Voted 8
Answered 1 times

Search




Leave an answer