Git+Hub

How to set up the git hub for a new project. Once you install the Git hub run the following command >git init newproject

when you type ls in /newproject you should see. .. and .git directory

>cd .git >ls -ltr drwxrwxr-x 4 smolgar ldap-users 4096 Aug 29 10:24 refs drwxrwxr-x 2 smolgar ldap-users 4096 Aug 29 10:24 info -rw-rw-r-- 1 smolgar ldap-users 73 Aug 29 10:24 description drwxrwxr-x 2 smolgar ldap-users 4096 Aug 29 10:24 hooks drwxrwxr-x 2 smolgar ldap-users 4096 Aug 29 10:24 branches -rw-rw-r-- 1 smolgar ldap-users 23 Aug 29 10:24 HEAD -rw-rw-r-- 1 smolgar ldap-users 92 Aug 29 10:24 config drwxrwxr-x 3 smolgar ldap-users 4096 Aug 29 10:53 logs -rw-rw-r-- 1 smolgar ldap-users 112 Aug 29 10:58 index -rw-rw-r-- 1 smolgar ldap-users 8 Aug 29 10:58 COMMIT_EDITMSG drwxrwxr-x 10 smolgar ldap-users 4096 Aug 29 10:58 objects

Come back to the home directory and create a file that need to be checked in or checked out.

Let us first try the check in

Create a file. > Vi First_test.txt >Hello This is my first Git Hub Code >wq

Check the Status of the current file in Git Hub

>git status It should show your file in red if its not commited or added. So to add the file to the repository

> git add First_test.txt now we need to commit

> git commit -m " Version 1.0" -m stands for Message

working - Edit Staging - Add Repo - Commit

to see the difference in file between Working and Staging the command to be used is

git diff

if you want to see the difference in file between Staging and Repo then

>git diff --Staged

if you want to see the difference in word then

>git diff --word-diff

to see the diff between Working -> Staging -> Repo

>git diff HEAD

To see the different version of the file the command to be used

> git log

To see what has changed in the files

> git log --stat

> git log --patch --word-diff

To see the top log entry

git log --patch -1

Fifth log can be found

git log -5

The following command gives you the difference in git log --pretty=full -1

Simple abbrev....

git log --pretty=oneline --abbrev-commit