GIT: A BEGINNER’S STORY
My Personal Story
I hadn’t planned on applying for an internship this summer and instead was going to wait until Spring 2012, but I found an amazing opportunity through my university to join the team at Globe Runner SEO. The description of the job sounded exactly like what I wanted to do for my career path, so I updated my resume and sent in an application. After applying for the Internet Marketing/Web internship, I was asked to come in for an interview and technical assessment. It’s hard to express in words how much I was simultaneously excited and scared about this potential new job. When the interview process was over, I was soon offered the position and able to start a week later.
I have never been exposed to Git, the open source, distributed version control system used for source code management. On day one, some might say I was thrown into the Git inferno. Fortunately, I had the help of an advanced Git user and amazing instructor, Chris Lee. He was able to show me the basic commands of Git, and what those commands are used for. At the beginning of the learning experience I was very intimidated by the usage and syntax of Git, but then started to better understand as the processes and uses became more clear.
Step 1: Find your terminal
The first step was to find and utilize a program that I didn’t even know existed on my computer, Terminal. Terminal uses a command line interface to let users interact with the computer, and Git can be run using Terminal.
Step 2: Create an SSH Key
Before accessing Git through Terminal, I had to create a SSH Key that allows for the identification of source code changes and also creates a secure communication channel between my machine and others. After telling Git who I am by using the command git config, I was ready for the next steps.
After setting up my SSH Key and telling Git who I am, the next step was to start using and learning the processes of Git. This was the part where I struggled the most as a new user because there are many commands to learn. There were a few commands that I was using very often, so I will point them out because of their important roles.
Step 3: Create a repository
The command git init will create a repository at the current local directory, and git status will tell me information about the working copy. Using git add will allow for the addition of new files to the staging area, where files are held before they are eventually committed using the command git commit. If I don’t feel comfortable with what is in the staging area and don’t want to commit those files, I can use git reset to clear the staging area. To view changes that were made, the command git log will show me the history of commits.
Step 4/5: Stage your Changes and Commit with Git
Finally, after navigating to the appropriate directory, creating a repository, adding files to the staging area, committing those files to the repository, and checking the status on the working copy, I can now push the changes to a remote repository. I first need to tell Git about the remote repository using the command git remote add origin <remoteURL>. When Git knows where my remote repository is located, I can now push my changed files to that repository using git push origin <branchname>. Now, my files should be located on the remote repository where they can be accessed by other developers if using a central server model.
As you can see, learning Git takes time, patience, and hard work. I am still extremely new to Git, but I’m very excited to become fluent in the use of it and discover new ways to use it. I’m sure my time at Globe Runner SEO will have me proficient in the use of Git in short time.