9

I work mainly on a desktop Mac but also have a laptop Mac that I use when away from the office.

I want to access and work on my latest html, css, php and python files from either computer.

I thought Github was the way to do this but am having a problem understanding the "flow" and I've RTFM! I don't understand whether I should create a Repository on Github first, why when I try to "clone" something it doesn't magically end up on my local computer... where the nice big red button that says "sync" is...

... or whether I should just use the commandline ONLY...

So, if I start on my desktop and create new files, what are the correct steps using git or Github (?) to put those files where they can then be accessed from my laptop and then have the files on my laptop merged back into the ?Github repository so I can then access those files from my desktop.

Thank you all for your replies and answers! The git workflow, for my needs, is now clear.

The workflow presented by wadesworld is concise and was the overview I needed.

However, Michael Durrant's commandline steps filled in that workflow specifically with commandline directives - and I needed that also.

steelclaw and uDaY's answers and responses were important because I did not understand that it did not matter which repo I created first and, adding and committing locally were essential first steps in my workflow.

Specifically, steelclaw's response to one of my response questions provided the closure I needed, so I could learn more:

After initializing the repository, be sure to use 'add' and 'commit.' These will make the files an official version of the repository. After that, you need to use 'push' to upload it to the remote repository."

ilollar's resource, "Git for Ages 4 and Up" is also worthy of the click, especially for folks like me who are visual!

Thank you all so very much!!

Vallynn
  • 213
  • 2
  • 8
  • 1
    You should read https://help.github.com/ based on your convinience use the commandline or GUI. Whether you create repo on github first or not, It doesn't matter when you create repo first but if you want to push local repo to remote repo(github.com) you should have remote repo present. As as _RTFM_ I dont know what that means... :P – uday Jun 10 '12 at 15:36
  • Yes, that page is https://help.github.com/ and is helpful. But I am unsure of the "flow," and am a bit lost. What "should" I do given that I want to copy everything from one computer up to Github, then copy everything that I've just "uploaded" down to my laptop, work on either machine but always keep - and be able to access - the most recent copy available on Github? – Vallynn Jun 10 '12 at 15:38
  • @uDaY: Are you saying use ONLY the commandline or ONLY the GUI (not both at the same time)? – Vallynn Jun 10 '12 at 15:42
  • @ValerieLynn, once you pushed changes to remote repo(on github.com). You have to clone it using `$ git clone git@github.com:username/.git`. You are free to use both gui & commandline at same time, no restriction. – uday Jun 10 '12 at 15:48
  • Retitled to try and make the the title and the body more consistent. – Michael Durrant Jun 10 '12 at 16:30
  • 1
    I would recommend using the command-line initially. While there's a learning curve, you'll have a better understanding of git by doing so. – wadesworld Jun 10 '12 at 16:49
  • Retitled to make the title question more consistent with body. – Vallynn Jun 10 '12 at 20:08

6 Answers6

6

Do you want to version control your files or just have access to the same files in both places?

It is a good idea to use version control as a developer, whether you're writing code or designing websites. But, to do so, you have to have a commitment to learning how version control systems work, since they all have some learning curve.

But, if you're not interested in that complexity and simply want to be sure you have access to the latest version of your files, then you're looking at a file syncing operation which can be much more simple.

So, which one do you want?

Edit: Based on the response, here's the model:

1) Create repository on work computer.

2) Create repository with same name on github.

3) Push to repository on github

4) At home, do a git clone to pull down the changes you pushed.

5) Now that the repository exists in both locations, you can simply do a git push before you leave work, and git pull when you get home, and vice-versa when going the other direction.

wadesworld
  • 13,535
  • 14
  • 60
  • 93
  • Wadesworld, thank you for bringing out that question of version control versus just access to the same files. I want version control and access to the same files. – Vallynn Jun 10 '12 at 15:57
2

To answer the detail of your question: I'd go with Dropbox.
UbuntuOne is also good even for non Ubuntu users and of course Google drive is the (big) new player on the block.

They compare as follows:

Service    Free*1  NextLevel*1  NextLevel($)*2  Features
Dropbox    2       50           $2.5O           One Folder, best gui sync tools.
UbuntuOne  5       20           $4.00           Multiple directories anywhere
GDrive     5       25           $2.50           It's Google.

*1 GB
*2 Cost per month

To answer the title of your question:

If you wanted something that's more suited to programmers, I'd use git:

First, install gitx (linux readers, that's gitg) as that is by far the most popular gui for git:

enter image description here

For the "flow" I can also refer you to my write-up of various features at:
What are the core concepts of git, github, fork & branch. How does git compare to SVN?

Using gitx or gitg the specific flow is as follow:

1) Make some changes to files.

2) Use the tools "commit" tab to see what's changed ("unstaged"): enter image description here

3) Add a file by dragging it from "unstaged" to "staged":

4) Give a commit message enter image description here

5) Commit the file. enter image description here

6) I then push it to the remote at the command line with $ git push remote or I use the gui by right clicking and select ing the 2nd master - see here: enter image description here

.

If I'm sharing with others I'll often need to do git pull to get ands merge in others chnages) before being able to do a git push

The github part is doing init and push and clone but I'd say just read up on those tutorials more rather than an SO question. Basically though, I do:

  • Set up repository locally in git:

git init
git add .
git commit "Initial commit"

Set up github:

Create a github repository using github (https://help.github.com/articles/create-a-repo)and then push your local repository to it as in:

git push origin master.

If the repository already exists on github but not on your local pc, that's wheh you click the remote link and then in a terminal type git clone [paste here, e.g. ctrl-v]

If you're "starting" with github:

  • Make code changes
  • git pull - get latest version into your repository and merge in any changes
  • git add . Add all modified files
  • git commit -m "message"
  • git push # origin master is the default.

If, at the end of the day you decide to go with something simple like Dropbox you can use my referral link -http://db.tt/pZrz4t3k- to get a little more than the standard 2GB, Using this we both get an extra 0.5 GB, however which of all these routes to go is up to you and your needs. I use all these services (git, github, UbuntuOne, Dropbox and googleDrive, so I am not recommending one over the others -it depends on the needs).

Community
  • 1
  • 1
Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
  • Thank you Michael. I'm reading the link you provided now. I was unaware I should have a visual as I though Github would do that. – Vallynn Jun 10 '12 at 15:52
  • Depends on the platform. On the Mac, SourceTree is rapidly becoming the graphical client of choice. – wadesworld Jun 10 '12 at 16:11
  • Michael, thank you. Your line items under "Set up repository locally in git" just provided a missing link (I think): Essentially, I need to create a repository locally (which I knew) but simply creating the repository doesn't say, "Hey, track everything here." Instead, creating the repository is more like saying, "Hey, here's a bucket I want to store things in." Using git add specifies *what* I want to store or track but still not does "pull the trigger." git commit pulls the trigger and establishes in my local repository what I am tracking. – Vallynn Jun 10 '12 at 20:26
  • I also just added an additional screenprint showing that you can also push the master to remote usung the gui ! – Michael Durrant Jun 10 '12 at 20:46
1

I would recommend using DropBox or Google Drive. They will let you do EXACTLY what you are trying to achieve, they are very user friendly (and free [5 Gb I think]).

They automatically update (as long as you have an internet connection obviously)

Just make a folder, put some files in it, and you are away.

beoliver
  • 5,579
  • 5
  • 36
  • 72
  • Thank you. I did consider Google Drive but my machines support separate Google Drives (i.e., different Google accounts) and I think that may be a problem. – Vallynn Jun 10 '12 at 15:53
  • Haha, indeed... any one of these can be used for this. It is what I do most of the time, far more than git to be honest. Just create a couple of alias' and your away. – beoliver Jun 10 '12 at 15:57
1

Since explaining how to use an entire VCS in one answer is an overwhelming task, I can instead point you in the direction of some very helpful resources to get you to understanding and using Git:

  • Pro Git - a free online book (written with Git!) with easy language on all things Git.
  • GitHub Help - GitHub's own help section walks you through setting up and using Git, and not just with their own apps. Very useful.
  • Get Started with Git - A good tutorial getting you up and running with Git.
  • Git For Ages 4 and Up - Fantastic video explaining the inner-workings of Git with Tinker Toys. Not best for an introduction into Git, but a great video to watch once you feel a bit more comfortable.

Git may feel complicated or strange at first, but if what you are looking for is a good version control system, it is excellent.

However, if all you're looking for is a cloud-like service to sync some files across multiple computers, like the others have mentioned, Dropbox would be the way to go.

redhotvengeance
  • 27,446
  • 10
  • 49
  • 54
  • You should also be aware that Dropbox has built-in versioning for files as well. It isn't full-featured and as robust as something like Git, but it does give you easy syncing and versioning. – redhotvengeance Jun 10 '12 at 18:17
0

I use Github as a "hub" of git, to share finished codes. (And Git for version control)

And Dropbox to sync files between different computers and mobile/tablet, to manage files.

http://db.tt/EuXOgGQ

They serve different purposes for me. Both are good!

Edditoria
  • 199
  • 1
  • 15
  • Edditoria, thank you. I am looking to make the workflow easier. Somehow, I thought Github would do that insofar as being able to house the latest files in a central location - and then I could access those files from anywhere, make changes, upload those changes and then when I get to my next machine, download the current fileset, work on them, upload them... – Vallynn Jun 10 '12 at 15:48
  • um... one point to note: In Git, usually you'll want to commit the changes (confirm your work/check-point is finished). If you use github to manage your codes, it may be not a good practice to commit the codes work-in-process. I would recommend Dropbox to sync files instead of manually upload/download tasks. Btw, try what you think first (only if you're working in small projects). – Edditoria Jun 10 '12 at 15:59
  • 1
    @Edditoria: Why wouldn't it be a good idea to commit work in progress? – echristopherson Jun 10 '12 at 19:34
  • @echristopherson um... I don't know how to say correctly. For example, I write some codes when I'm waiting my friends in coffee shop. That is not a right time to commit changes if the code is not tested. I just leave it to sync to the cloud. I only commit changes when I believe the development achieves something (e.g. created a menu, fix a bug, etc.). – Edditoria Jun 11 '12 at 04:33
  • @Edditoria, I understand what you are saying. For the purpose of this question, I needed to understand the git workflow. Given my circumstance, if I were in that coffee shop writing code while waiting for friends, I *would* commit regardless of testing, simply so I could pick up from where I left off when i get back to code writing. – Vallynn Jun 11 '12 at 17:31
0

Git is an advanced and rather difficult tool to use for version control. If you're feeling brave, you can try to install the command line tool, however I recommend using a graphical client, specifically SourceTree. http://www.atlassian.com/software/sourcetree/overview

You'll need to clone your repository, or else initialize a new one. To connect to your repository, you'll need to know the URL, and possibly a username and password for your repository. You also need to provide a valid name for the repository.

To update files there are several steps: First, you need to add the changes to the directory. Source tree might do this automatically. Then you need to commit the changes. This is basically confirming changes and signing them with a comment. To upload them, you need to use push and select the correct remote repository. When you want to update your local repository, you'll need to use pull and again select the correct remote repository.

For your purposes, however, it seems like dropbox might be better, because it automatically updates and is very simple. If you don't need the advanced version control that git provides (e.g. branching, merging from many users), then it seems like it would be a better option for you. https://www.dropbox.com/

jepugs
  • 445
  • 4
  • 10
  • Thank you. So, I have a set of files in a local directory that I want to be able to have available from anywhere. This is my "local repository" after I initialise it as such, yes? – Vallynn Jun 10 '12 at 15:46
  • 1
    Yes. After initializing the repository, be sure to use 'add' and 'commit.' These will make the files an official version of the repository. After that, you need to use 'push' to upload it to the remote repository. – jepugs Jun 10 '12 at 15:52
  • Which repository should I create first: the local repo or the remote (GitHub) repo)- or does it matter? – Vallynn Jun 10 '12 at 15:54
  • 1
    @ValerieLynn, it doesnt matter which one you create first. It only matters when you think of pushing your local repo to remote. Because then git would like to see if there is a placeholder for your repo in remote site, so you should have before you **push** local source to remote. – uday Jun 10 '12 at 16:04
  • @uDaY, I think what are you saying is, I can create either repository first - local or remote. But, when I want to push my local source to a remote, I need to make sure a remote repository exists first. Thank you. – Vallynn Jun 11 '12 at 17:34