Hello GitHub, my name is Melissa

HoraWatch_GitHubI was introduced to GitHub a few month’s back. I was hooked instantly!

To be honest, (don’t cringe too much) I have never used any type of version control software (VCS) for my personal programming projects. However, one day, I found myself in that awkward position where I wished I did have a VCS in place. It took a lot of ‘wasted’ time and effort to refactor my code to a previous state – ouch!

My introduction to GitHub came via CodeCoalition‘s iOS Bootcamp. During the course, the instructors shared just a few commands – enough to give the students the basic knowledge of GitHub.

You may be wondering – what is GitHub anyway? At the core, it is Git – a version control system that manages and stores revisions of projects. GitHub is a web-based hosting service that uses the Git version control system, while adding many of its own features. GitHub is more than just a programmer’s tool. If you want to collaborate on anything, GitHub is the way to go! It is now the largest online storage space off collaborative works with all the social networking perks.

Why use something like Git? Has there ever been a time where you found that you and a colleague are both updating pages within the same website? You have made your changes to the page, saved them, and uploaded them back up to the website. At the same time, your colleague is working on the same page as you. One of you is about to have your work overwritten…erased…gone!

By having a version control software in place, the example above would not have happened. You and your colleague can each upload your revisions of the web page – two copies will be saved (respectively). The next step would be to merge your changes without losing any work along the way. A great feature of VCS is that you can even revert back to an earlier version at any time, since it keeps a ‘snapshot’.

With the many current mobile projects that I am working on, I decided to upgrade my GitHub account to a paid subscription. I also found the need to expand my knowledge on the commands specific to Git (and Terminal). This has already proved to be a life saver.

Below are some of the Git commands most helpful to me.

common git commands for reference

git help

create a new local git repository
git init

clone an existing repository
git clone https://github.com/username/repositoryname

lists changed files in your working directory
git status

list changes to tracked files
git diff

add all current changes to the next commit
git add .

add some changes in to the next commit
git add -p

commit all local changes in tracked files
git commit -m "commit message here"

publish local changes on a remote
git push -u origin master

show all commits, starting with newest
git log

create new branch and switch to using it
git checkout -b

switch back to master
git checkout master

delete branch
git branch -d

update local repository to the newest commit
git pull

merge another branch into your active branch
git merge

 

There are many great resources and tutorials out there on how to get started with GitHub. To get started, I recommend visiting GitHub’s Help Section: Set Up Git.