kemayo / sublime-text-git

Plugin for some git integration into sublime text
MIT License
2.83k stars 390 forks source link

A few questions #263

Open MickeyKay opened 11 years ago

MickeyKay commented 11 years ago

Hi there,

I've been using ST2 for a while, but am brand new to git. I'd like to integrate it into my workflow, but can't seem to figure things out with this package. I've got a Github account setup, and I have things working with my Mac desktop Github application, but can't for the life of me figure out how to use this package. Any help would be much appreciated. Ideally, I'd like to be able to integrate the following workflow in ST2:

  1. Work on any number of files in a given project.
  2. Run a simple command (using this package, I assume) to push/commit (not sure quite what the difference is) either the entire project, or specific files.
  3. Checkout the files with a simple command when need be.

I've tried installing the package, but I can't seem to configure it correctly. For example, when I try to push I get this error message: fatal: No configured push destination.

Either specify the URL from the command-line or configure a remote repository using

git remote add <name> <url>

and then push using the remote name

git push <name>

The whole point of this is really just to assure that my colleague and I have good version history in case something goes wrong. Is this even the way we should be going about this?

Again, forgive my ignorance - Git is a whole new thing for me :) Any help would be much appreciated, thanks a ton!

All the best, Mickey

ZaLiTHkA commented 10 years ago

Git may seem rather complex at first, especially if you're coming from another type of SCM system.. I'd suggest you have a browse through this guide to better understand what goes on behind the scenes, once you get the hang of it you'll start to see patterns in the workflow and it will all fall into place. :)

For now though, I'll assume you've created a repo through the desktop app, you've got that published to GitHub and that you're now trying to work with that repo through Sublime (?)...

In a nutshell, to do what you're asking first open your local project folder in ST (the one that holds your .git folder and .gitignore file), then the following will apply:

  1. Git mentality is a "make changes now, decide which to keep later" type of flow. So yes, open your files and start hacking away..
  2. This is a three step process: essentially you git add files to a temporary list, cherry picking the changes you want (or simply including all), then you git commit them to the currently checked out branch, and finally you git push the branch to it's linked remote origin.
  3. I think what you want here is a git pull, it's a two step function the fetches and then merges the linked remote branch with the local one. The fetch simply gets the changes, while the merge applies them to your local files.

The error you're seeing is essentially Git tell you the currently checked out branch does not have any remote origin to push it's changes to. This page should help a bit with the git remote add command.

And yes, if you're using Git, you do have a very good version history system. Be sure to check how tags work in the GitHub web UI ('Releases' button above your code view) once you get to grips with the commits... :)