How to Use GITHub.com ? A Simple Example using git commands.

1. Open terminal
2. sudo apt-get install git
3. Enter into your directory

cd folder/                              

git init                                             

git add .

git status

git pull https://github.com/username/repository.git

git config --global user.name username

git config --global user.email username@gmail.com

git commit -m "first"    // Here first is only a label to your commit, you can write any label to remember your commit

git remote add origin https://github.com/username/repository.git

git push origin master


** Good practice : folder name and repository name must be same

Now check you github files are uploaded there. Now make some change in your code and try again commiting on github with following commands.

git add .

git status

git commit -m "second"

git push origin master

Now check you github account, you will be having 2 commits. Any new changes will be shown on file with red and green colors with - (deleted) and + ( added) symbols. 

If you need any explanation, kindly comment below.


Comments

Popular posts from this blog

Java Practice Questions MCQ

Linux Assignments - Practise

HackerRank Introduction Challenges - Java