Git / Github

What is git? github?
Git and Github are version control systems. Git is used locally on your computer while Github is used externally (online). They can store different versions of your files and folders. On Github and Git these are called repositories, repos for short. This has an advantage of going back to previous versions should you make mistakes in your code; also you may have previous ideas in earlier versions that you may now want to use as a more final draft.

Why would I need it?
You could use both Git and Github to go back to previous versions. Github has the added advantage of more easily sharing and collaborating code with others. Also Github can be a good way to easily show potential employers your skills, a type of portfolio of your work

How would I add files to git?
I’d do the following in terminal (using a mac)
[# is commented out to show what each command does]:
git init #creates git file in desired folder for tracking
git status #shows if there are any files to commit
git add . #git to add everything
git status #should show nothing to commit, unlike previous git status
git commit -m “first commit” #git to track, message (-m) what’s changed
git log #shows versions, author, previous messages and date and time

With Github you would:
git init
git add .
git commit -m “First commit”
git remote add origin remote repository URL
git push -u origin master
[Github commands from Github Help [1]]

How would I download them?
You’d go to your Github repository or a repository you wish to download.
Then click the green Clone or Download button.
Then either:
(a) Click download zip and unarchive
or
(b) Copy link address. In terminal:
git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
[Github Help [2]]
What about copying a new project? what does cloning mean?
[Copying a new project?]
I’d just click “Clone or Download” as previously stated.

What is forking?
Forking is taking a pre-existing repository, modifying it and putting it into a new repository: where a link to the original repository is shown; and it’s obvious that it’s based on the original via a link in the forked repository.

Do I have to use git? Why not use subversion?
No! Git just maybe has the users. It’s personal preference. It’s even personal preference if you have to use version control at all. Though certainly, if you are working for a company, they will most likely use some type of version control system. However, if you are working for yourself there’s less obligation to use it; though some awareness of it is advisable and could be handy for future reference.

A Visual Guide to Version Control
Version Control (Wikipedia article)
Version Control in Practice (Slides)
Learn Git in 20 Minutes (Video)
Populatity of source code hosting facilities (Wikipedia article: section #Popularity)

I have experience in using Git and Github: in creating, cloning and forking repositories both from “manually, drag and drop” and through terminal. Additionally I have experience of automating the Git process using bash scripts.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s