note: Think of the process as checking out a shopping cart.

Note: Use  | less  to page results

git ls-remote origin | less

 

Version of GIT

git --version

 

Make the GIT output coloured

git config --global color.ui "auto"

 

Create the Repo

cd Documents

git init mywonderfulrepo

 

This makes Documents/mywonderfulrepo/.git

Note:the git archives and mechanics are stored here.

 

cd mywonderfulrepo/

touch index.html

git status

> untracked file

git add index.html       <- adds this to the staging area

git status

>... new file: index.html

git commit                <- adds the files to the repo (add a comment as well)

Create a new file

touch index.html

Add a file to staging

git add index.html

git add .    <- this adds all files at this level and  folder children


git status

> new file:  index.html


How to commit all files from staging.

git commit -m'Hello this is my message'

 


To create a new branch

git branch mynewbranch            <- base the branch off the current branch

git branch hash mynewbranch    <- base the branch off a different commit

git checkout -b newbranch           <- create a new branch and check it out


Swap to a new branch

git checkout newbranch