Github hacks

Most new developers find Git/Github quite complicated and difficult to use. Good news is you can use Github if you understand or follow about 6 commands. Today I am going to share the git commands/procedures which every coder should know.

Step 1: Creating an account on Github. If you already have one, skip to step 2. Otherwise follow this link to create your account.

Step 2: Creating your new Github repository. Do this by logging in to Github, and create project.

Step 3: At the point you have two options:  clone it (create a duplicate of the repository on your local machine), or create a local repository on your local machine and link it to the remote (Github) repository.

Option 1:

  • Run:
git clone

in your directory, creates a clone of the Github remote repository on the computer it is run.

  • For any changes you make, run the following commands
git add .

Significance: Adds all files for tracking. Note the . at the end of the command.

git commit -m "your message"

Saves the changes made as a version of your program

git push -u origin master

Pushes the code to Github so that your local and remote repositories are similar

Option 2:

  • Initialise a git repository locally by running the command below:
    git init
  • Then the other commands as above

    git add . 
    git commit -m "my message"
  • Link the repository to the remote repository by running:
    git remote add origin
  • Push code to the remote repositpory git push -u origin master

Get familiar with that. You can see more info on collaboration and branches on the Github documentation and the Git cheatsheet.


Leave a Reply

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

You are commenting using your 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