First steps with GIT
Until a couple of months ago I’ve been happily maintaining my open source ePortfolio manager on the Google Code site (which uses subversion for version control). The Google code site is due to close. Google are therefore asking everyone to shift their code elsewhere and offering a handy service to export to github (a popular code sharing site) on your behalf. I took advantage of this service to back up all of the code from Google. It now resides here as an archive.
I haven’t used GIT before so I need to do some catching up.

From now on I only intend to develop the latest version of EPManager (version 3) so I set up a new repository on github separate from the code transferred from Google. This offers me a clean break from the old code. The new version 3 is currently being piloted in the College and when rolled out the ePortfolios will use the latest WordPress release (4.1).
The new GIT repository for EPManager 3 is here. I have already updated the code to take advantage of WordPress 4 and upgraded the php mysql code to use mysqli (more about that in a later post).

I’ve never used any of the more advanced capabilities of subversion so my knowledge of that system hasn’t got in the way of learning how to use GIT!
I found this website a really good starting point and wasn’t afraid to admit I know nothing and to start from the “Getting Started” chapter.
GIT works quite differently from subversion and I picked up on the three states of a repository pretty quickly (committed, modified and staged). To check out the latest code I use:
$ git clone --bare https://github.com/osaeris/epmanager3.git epmanager3
Now in the epmanager3 folder I have, unsurprisingly, a clone of the master branch of the repository.
Find out where you’re at with git status
$ git status On branch master Your branch is up-to-date with 'origin/master'. nothing to commit, working directory clean
I copy this cloned code to the development folders where I’m actually working on the application then when I’ve updated a file (in this case config.back) I copy it into the appropriate folder in the git repository (which I’m already sitting in):
$ cp /etc/epmanager3/config.back etc/epmanager3/
Now the current status shows a change:
$ git status On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: etc/epmanager3/config.back no changes added to commit (use "git add" and/or "git commit -a")
Now I know I have change something but not yet staged the file (equivalent to telling git that the file is now ready to commit). That’s done by:
$ git add etc/epmanager3/config.back
Now the status shows another change:
$ git status On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD ..." to unstage) modified: etc/epmanager3/config.back
Finally I send my edited file to the remote repository:
$ git commit -m "remove white space from config.back" $ git push
The result of the commit is shown
Counting objects: 12, done. Delta compression using up to 2 threads. Compressing objects: 100% (6/6), done. Writing objects: 100% (7/7), 768 bytes | 0 bytes/s, done. Total 7 (delta 3), reused 0 (delta 0) To https://github.com/osaeris/epmanager3.git 7671f85..e6593ad master -> master
This is a good starting point. In the next few weeks I’ll be working through the rest of the book on git-scm.com and can hopfully make more complete use of the features of GIT than I managed with Subversion. The github website allows you to edit files directly on their website with a commit message which is much quicker for minor changes than copying a file from your development server, using git add and git commit (maybe for a spelling mistake).