Using Git and Github Step by Step

Today we had what was technically our first day with The Software Guild. Funny to think after the last two weeks I’ve only now had my first day of this program, but those first two weeks were probationary, almost like rushing a fraternity, and now we’re in!

Today we practiced communicating between our Gits and Githubs.

Git is an application that runs through a command line, in my case terminal since I’m on a Mac. It is a local app for writing code. Github is a way of storing and accessing that code globally, via the internet.

Our new teacher, Professor Polk had us practice pushing memes to our githubs via our command lines.

These are the steps in detail.
1. Create a new repository on Github.com
2. Create a folder on your own machine, mine went on my desktop.
*naming is important for organization so name in a way that makes sense to you.
3. Navigate your terminal so that you are in your new folder by using the “cd” command.
4. Go back to your Github repository and select the “clone or download” option. Then copy the url presented.
5. Now in your terminal (which is navigated to your new folder) type in “git clone” and paste the url you’ve copied from Github.

Now if you check your folder on your machine you should see the repository from Github in there. Next, we practiced the opposite, putting things on Github via Git.

We all found memes, these are the ones I went with:

Note: I did add these individually for the sake of practice.

Now to sync my Github to my Git I had to do the following:
1. Make sure your terminal is navigated to your new repository folder on your machine.
2. In your terminal type “git add –all”
3. Next we will type a code that adds a comment to this upload, this is useful if you’re communicating with other programmers but also just for your own clarity later on. Type this code into the terminal:
git commit -m “put anything you’d like here to clarify what this new info is”
4. Now type “git push origin master” into your terminal.

Check your Github and the new files should be there!

***A note regarding pulling…
I didn’t pull any files because I knew that nothing had been added o my Github repository since I cloned it, but it’s good practice to pull files before the above steps (but after you’ve pulled the repository and navigated to it). Basically you want to pull files before you add any of your own local files to your Git, so before you type “git add –all”.
To pull files, once navigated to your repository in your terminal you type “git pull origin master”

And that’s all!

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

Create your website with WordPress.com
Get started
%d bloggers like this: