Practical GIT and GitHub

GIT has many advantages over earlier systems such as CVS and Subversion (SVN), it is More efficient, and better workflow.
Many git tutorials and guides cover a lot of details make it hard to use as a practical guide.

You can find a lot of cheat sheets for git but again, if you are a beginner it will not help you.

The purpose of this guide is to go over the basic tasks we can do using git and github in a practical view

This guide is the first part – working on a project alone (one man show)

 

Installation

Download and install git from  https://git-scm.com – use the default settings

Open an account in github.com for remote git

 

Create a new project

  1. Go to github.com and create a new repository (start project)
  2. in git shell paste the following commands:

Note: change the address to match your account

 

Working on the project

most of the time as a programmer you are doing this

  1. add files and directories
  2. Add the files to git and github using the following commands:

 

 Creating a new version 

you want to test a new features for your project but not to break the current version – you need to create a branch and move to that branch

  1. create a new branch
  2. move to that branch
  3. add/change files
  4. commit and push (local and remote)

 

Working on your project with different versions:

now you can move from branch to branch and add/change anything you like just add and commit your changes to the local and remote repository:

you can move from brach to branch and do the above commands working with different versions

 

Merge changes from branch to branch

You can see the difference from other branch to the current branch using:

you can merge the branch changes to the master using:

 

More useful command you can use anytime:

git status – see the current branch and status

git log – see the history

git revert – revert your changes

 

Next post – git in a team

 

 

 

 

Tagged

Leave a Reply

Your email address will not be published. Required fields are marked *