GIT By Chloe

Git is a distribution version control system that makes collaborative software projects more manageable.
Most projects will have a git repository which makes sharing and contributing to code simple and effective.
The repository (repo) is the main folder of a project, it contains all relevant project files and stores the revision history for each file.

Forking a repository:


On GitHub on the main page of the repo you will see a 'fork' button on the top right hand page, click this to fork.
Once forked open up the terminal window to, and clone the repo to your text editor by using:

git clone URL OF FORKED REPO

Creating a new branch:


The default branch for any project is the 'master branch' - anything on the master branch is deployable for others to use at anytime.
When creating a new branch it is important to create your branch off the master branch.
The branch name should also be descriptive.
To create new branch open the terminal and put in the follow demands:

git branch 'new-branch-name' - creates new branch

git checkout 'new-branch-name' - switches to new branch

git checkout -b 'new-branch-name- - combines the two above commands to create and switch to new branch at the same time

git checkout master - switch back to master branch.

Creating a new repository:

Below are the step by step commands that need to be inputed into the terminal to create and add work to repositories (on the master branch):
1. git init - To initialize the repository.
2. git status - To see what needs to be staged in the repository.
3. git add . - To add all the files to the staging section.
4 git commit -m "commit message" - Commits all the files in the staging section to the repository. The message should be descriptive so that othe developers know what has been done.
5. git remote add origin 'URL of repo' - Adds the URL of where the repository will be stored.
6. git push -u origin master - Pushes all of the pages to a git branch i.e. GitHub.