August 9, 2012 - 1 comment.

Getting Started with GIT for Designers

Just an overview of how I managed to get started with GIT - which wasn't that easy, I tell you!  But, it isn't difficult.

Firstly, the scene

I am running GIT, through terminal, on MacOSX Lion.  #justsayin

  1. Install GIT (already installed on MACOSX - got to step 2)

  2. Find a repo provider:  You want a third party provider like Beanstalk (1 free) or Github (free if public, fee on private).

  3. Setup the secure shell connection

You need to setup your repo keys to ensure secure syncronising.  Here are the guides I used:

http://guides.beanstalkapp.com/version-control/git-on-mac.html?utm_campaign=help_page&utm_source=app

I had troubles with PTY errors and other permission denied.  But actually it works anyway!  As long as your ssh keys are paired.

Using GIT to "Upload"

  1. Open or Create a project (folder) and attach GIT to it
mkdir project
git init

You now have a .git hidden file which is the GIT source control file

Upload your project to your REPO

I followed this guy here: http://thelucid.com/2008/12/02/git-setting-up-a-remote-repository-and-doing-an-initial-push/

git add *

(Adds all the files in your directory to the GIT "staging area" - a holding ground before you finally make the upload (commit))

git commit -m "your notes"

Here you commit the staging area files to the repo (like FTPing) and you leave a nice note, for yourself and others, that is understable and useful.  Congratulations you uploaded your first GIT project.

"Downloading" your project to another folder (or: pulling your repo).

Go to your other computer and find the folder you wish to "sync" your project with.

git pull "src"

(where src is your repo url)

Will download, update and overwrite your local project files with the ones in the repo.  Congratuations, you now have two versions of the project in two locations (plus your repo).

Make changes

The idea is to make changes, right?  So go ahead and make some changes in the files of one of your projects / repos.  If you want to see how GIT sees these changes, type GIT STATUS into terminal for a summary.  Then:

Git add .
Git commit -m "note to self, and others"

Happiness. You've synced your local version to the remote repo.

Go to your other project repo,

git pull "src url"

Happiness!  You've updated your second repo in line with your updated first repo.

You want more commands?

http://jonas.nitro.dk/git/quick-reference.html

Plus another great article: http://www.alistapart.com/articles/get-started-with-git/

http://hoth.entp.com/output/git_for_designers.html

Troubleshooting

I had this PTY problem, but it turned out to be a non-issue:  http://help.github.com/ssh-issues/

Advanced (Submodules)

So, maybe you want fork other people's repos and include them in your project?  You can do this the right way, or the wrong way.  The right way is through GIT submodules.  I'll be honest and say that submodules is not easy - I don't know how many times I looped through this process: adding, deleting (which isn't easy - see below), adding again.

The short version is this:  Navigate to the root folder in your GIT "working tree" (where you installed GIT)

git submodule add git://github.com/3RD-PARTY-REPO-URL/REPO.git YOUR/PATH/TO/INSTALL/FOLDER/NAME

This advice mainly came from the horse's mouth: http://git-scm.com/book/en/Git-Tools-Submodules

It doesn't work, now what?

It should / will work - but no doubt something has gone wrong.  So you need to start again, following GITHUB advice (above) TO THE LETTER.

BUT, you need to remove the submodule before you can start again.  This is not simple.  I did this:

  1. Delete the relevant section from the .gitmodules file.
  2. Delete the relevant section from .git/config.
  3. Run git rm --cached path_to_submodule (no trailing slash).
  4. Commit and delete the now untracked submodule files.

Following the advice from here: http://stackoverflow.com/questions/1260748/how-do-i-remove-a-git-submodule - and I am so glad these guys exist!

How do I edit .gitmodules?

Good question.  You use Vi or Nano on the command line:

vi .gitmodules
  1. X (to delete characters) - delete the submodules info, you will see it
  2. :wq! (to save and exit vi)

Simple, eh?  Have fun!  I did, I had a great time, ALL DAY LONG!  Once you've finished and it's all looking hunky-dory, don't forget to commit your updates to your staging area (as above) and push the changes to your remote repo, ok?

Updating a repo with submodules

GIT pulls the repo directories down with the cloning, but doesn't actually pull the files.  You need to do this:

$ git submodule init
$ git submodule update

To initiate and update your .gitmodules files in the new project.

Cloning a new project with submodules into a local repo

git clone --recursive {REPOURL}

Terminal vs GUI

I'm actually a bit nerdy as a designer, and I love using terminal and Vim (as opposed to a visual GUI and Dreamweaver or kin).  I guess I dig the same underlying work philosophy: simplicity, and there isn't an interface more simple than Terminal (that I am aware of).

But, I understand most/some designers abhor a visual vacuum, so try this GIT GUI: Tower

 

Published by: admin in Development

Comments

xyahoo.com
May 28, 2014 at 3:23 pm

Heya i’m for the first time here. I found this board and I find It truly
useful & it helped me out a lot. I hope to give something back and aid others like you aided me.

Leave a Reply

%d bloggers like this: