Step 1 :
Create an account in Github
Step 2 :
Create a repository(it is Basically, a folder which will contain and track your project)
Step 3 :
Create a folder in your local computer where you want to keep your project with the same name of repository in step2.
Step 4 :
Through Terminal Dive into the folder you just created then run this command
$ git clone <Repo Path> .
It will copy and paste all the files or folder into your local system. where replace variable with
SSH clone URL or Http clone url
which you have to copy from
https://github.com/\<userName\>/\<repositoryName\>
bottom right of the page and dot signifies copy all files and folder of the repository in github to folder name same as repository in local system
Step 5 :
Initially it will have three file .gitignore, LICENSE, README.md . Now, in this folder you can create, delete, modify your project.
Step 6 :
Afer modifying any thingin in local folder named same as repository run
$ git status
It will show you the file which you have added, deleted, modified
Step 7 :
This will add your local changes
$ git add .
wait wait.. you will not get any this in online github repository.
Step 8 :
$ git commit -m 'what ever message you want you can but it's beter to give what are the changes you made this may vary for different commit'
This command will commit all changes whit you just added in previous step.
step 9 :
$ git push -u origin master
This command will finally push all the changes you made in local to github repository where origin is master branch.And
$ git push origin gh-pages
this command push all the changes you made in local to github repository where origin is gh-pages branch. A github repository can have branch:master or branch:gh-pages
.Every time you run this command it will ask you user credential which you signed in with.
###Step 10 :
For one time user credential run $ git remote set-url origin git@github.com:<Username>/<Project>.git
step 11 :
$ git pull origin master
This is actually fetch github repository and merge with local folder named as repository name . this will generate conflict if you haven’t commited you local changes yet. To remove that conflict you can do manually or follow step 13 and step 14.
Step 12 :
To see the file which is having the conflict run in terminal
$ grep -nr "<<<<<" *
Step 13 :
$ git reset HEAD #Reset in history
Step 14 :
$ git stash #To remove local changes