Getting started with GIT with simple commands

github-logo       Getting started with GitHub can be torture unless you come from a Linux background. I hated it so much because I was so use to getting programs with user interface so the last thing I wanted to look at was a terminal or a command prompt. I started to use the GitHub application but I was creating problems for my team mates and even that can be confusing. Most of the stuff online about Git is very dense and makes it hard to get started. I did find a great website for some simple commands after digging through all the advance material out there.

After learning a handful of commands it really is not that bad. If you are new to Github then most likely you will just need to know a handful of commands to get by and just let the more experience guys do the rest. I will assume that you already did the setting up Github by downloading it and configuring it. You will also need to set up an account.

Cloning a Github Repository

Sometimes you may need to only clone a Github repository if you are not going to contribute to a project on git. This is also a starting point if you are coming onto to a team with a repository already setup.

Here is the steps:

  1. Open the Terminal/ Command Prompt 
  2. Create a directory(i.e  ‘mkdir foldername‘)
  3. Go to that directory (i.e ‘cd foldername‘)
  4. Add git to it (i.e. ‘git init‘)
  5. Add project in the directory by cloning a repository  with the ‘git clone command url ‘(git clone https://github.com/nicolasgramlich/AndEngine.git)

To get the link  to clone the site visit the link where the repository is at and there will be a HTTPS clone link on the  page. Here is a screen shot of what I am talking about.

 cloninggithub

Here is the full example screen shot to clone a repository.

Cloning Github Terminal

Contributing to a Github Repository

I like to look at this as a 2 part process. You need to do a pull request which is updating your local project with what is on the repository. This will not erase your changes but just merges the changes. Then after you do a pull then you can do a push.

Pull request for Github

Like I said this is updating your local project with what is on the online repository.

  1. Make sure you are in the right folder inside the terminal/command prompt ( use the command ‘cd’ to  move between folders i.e cd myproject , or just ‘cd’ to start over).
  2. Add your files with the ‘git add . ‘ command ( the ‘.’ will add everything but you can you specify the folder here if you like) 
  3. Commit your changes and add a message with the ‘git commit -m ‘message
  4. Pull with the ‘git pull’ command ( you may also need to add the url to the repository that you use earlier for the cloning).

Your folder is now updated.

Push to a Github repository

This will update the online repository with what you have in your local directory.

  1. After committing and pulling.
  2. Use the ‘git push‘ command.

Switching Branches

You will want to switch branch if you want to pull and push to a particular branch on a particular online repository.

  1. Inside the terminal make sure you are in the right folder with the ‘cd’ command (i.e cd foldername or use ‘cd’ to start over)
  2. Use ‘git checkout branchname

 

More to come and screen shots ….


Graveyard Database Logo

Has everything you want to know about grave yards. Plus has many celebrites and world leaders graves. Pssst it is my other site

Google + Profile
Check out Android Photo Mapping, its a app/site I been working on

  • wholesale nfl jerseys
  • wholesale nfl jerseys china
  • wholesale sports jerseys