Git is the source control management software of choice by many developers. It feels very light weight and yet is a fully functional and quite easy to use tool for most developers. For those that need extra help with Git there are a ton of resources out there for you, including this article.
So, to get started you should install Git. Go to the Git website (http://git-scm.com/downloads) and download the appropriate package based on your OS. This will install the tools necessary to use Git on your local system.
Steps for Starting a repository locally:
- Install Git
- Open the command promptterminal window
- Change the directory to where you would like to start a repository
you may use commands such as:
cd <<dir>>
to change the current directory
mkdir <<dir>>
to create a new directory ormd
in windows - run
git init
to create the repository in the current directory.
In a case where you have an existing repository that you want to have a copy of:
Follow Steps 1-3 as stated above. In step 3 you will go to the root directory of where you want the repository since getting a copy of the repository will create a directory for the repository.
instead of git init
, we will run git clone
to copy or clone the remote repository.
git clone <<url>> [directory]
<<url>> – could be a URL for GitHub or Bitbucket or just a remote network path
[directory] – is an optional parameter to provide the name of the directory you will create the clone in.
In either case you will result in a local Git repo that you can begin working in. You can create projects, store files and then use your git workflow to save your changes to a remote repo.
git add
git commit
git pull
git push