Using git with a flash drive, oh what fun!
Git does a lot of stuff. Fortunately, we don’t care about most of it. Here are some tips to make git work for you (and not the other way around).
If you have a flash drive, and would like to use it for the class, git can make that work for you!
Simply insert the flash drive into the computer, and take note as to which letter it gets assigned. In this example, my flash drive was assigned the letter “D.”
First step, open up git-bash. You can do this however you wish, I’m doing it by navigating the start menu -> all programs -> git -> git-bash
Now I need to get to the flash drive. I “cd /d” and now git-bash is open on the flash drive. After we set everything up, you’ll be able to just open your flash drive and right click on the cs105 directory and select “Git-Bash Here,” and not have to do all of these steps. Right now we can’t do that though.
Once you have git-bash open and have it looking in your flash drive (do an “ls” and see if the files are familiar), you can check out the git repository. You do this by typing “git clone git://github.com/michaelee/cs105.git cs105″
You should now have a folder “cs105″ on your flash drive (do an “ls” and make sure). That’s your project directory, you’ll want to change to it (cd cs105). Inside the directory are folders for each lab. Whenever you want to work on a new lab, type “git pull” to get it. You will not need to do any fancy git clone hullabaloo after you’ve done it once. Once you do a “git pull” you should have all of the new files and folders. If you get any error messages, ask your professor, or the TAs, for help. Usually, all that should display is the downloading of files, or “Already up-to-date.”
So, recap:
Setting it up:
Insert flash drive
Check which letter the flash drive is.
Open up git-bash and “cd /<lower-case-drive-letter>”
git clone git://github.com/michaelee/cs105.git cs105
cd cs105
git to work! (ha ha, get it? I so punny)
Using it afterwards:
Open flash drive
Right click on cs105 folder and select “open git-bash here”
git pull
work!
Now, you can take your work home with you and use it there, or pull out your flash drive and use it in any of the lab computers (the instructions won’t change), and you don’t have to memorize all the arcane git commands. Fun, eh? If you are interested in what happens behind the scenes, e-mail me and I can explain it in more detail. However this post is designed to help you use git more easily, without necessarily understanding the nitty gritty details (after all, not all of you are mechanics, but you can drive a car; same principle).
-Evan Larkin
Phil_Tam:
First Comment!
Isn’t it better to just drag and drop the cs105 directory onto the flash drive if you had the folder on the decktop already?
August 29, 2008, 1:33 pmEvan Larkin:
You can do that too, however this howto was written assuming that you didn’t have anything done yet.
If you do drag and drop the cs105 directory onto the flash drive, you simply skip the first group of steps. git pull will still make your life easier, as will “git bash here”
Starting from scratch though, you can use this guide in full.
(drag and drop assumes that the cs105 directory is still a git repository (still has the .git folders and stuff in it))
August 29, 2008, 2:49 pmsmenezes:
I have the folder cs 105 stored on my flash drive. However, when I Right click on the cs105 folder there is no “open git-bash here”.
September 4, 2008, 3:25 pmEvan Larkin:
That option depends on how you installed git. The lab computers in SB108 have been installed with this option enabled, while a few of the SB112 computers have not had this option enabled.
If you follow the instructions to install git on your personal windows PC, you should have this option. If not, e-mail me at elarkin@iit.edu and I can walk you through installing git so that you can use this option.
September 11, 2008, 11:53 pm