Working with GitHub is an important skill these days for web developer. As many developer can work on same project from remote location.Using git we can share our code with rest of the world.
Lets see how Git Works
Git is basically a way by that we can add ,clone or download files from remote or local repositories. To working with Git we need to download a program from Git-scm. This program available in Windows ,MacOS and Ubuntu. Download according to your operating system.
Once you have program installed. There are some commands in git you should be familiar with. Check few below
$ touch index.html //creates index file in current folder
$ git init //Initialise Local Git Repository
$ git add //add Files To Index
$ git status //Check status of working tree
$ git commit //Commit changes in index
$ git push //Push to remote repository
$ git pull //Pull latest from remote repository
$ git clone //Clone repository to new directory
$ git rm --cached index.html //Removes file from staging area/to be committed list
$ git config --global user.name 'Username' //adds username to git
$ git config --global user.email 'email address' //adds email to git
$ git add *.html //adds all files to staging area with ".html" extension
$ git add . //This adds every file in staging area
$ git branch mybranch //Creates a branch with name "my branch"
$ git commit -m 'some comment' //Commits directly with comment
$ git checkout mybranch //switching branch to mybranch
$ git merge mybranch //After all changes done merges branch with main(master) branch
$ git add --all //adds all files to stash
$ git reset //takes out all files from stash
$ git clean -n //Tells which files going to be removed from local untracked list ,Does't remove notifies which files will remove
$ git clean -f //removes local untracked files from current git branch
$ fit clean -f filename //will remove single file
$ git rm -r directory name // will remove the direcotry annd files in it
Every command matters and does as given in above.
Lets See What is GitHub
Github is a website where we can store data and share with others.We basically push data to repository . And can share the link to repository. So open the website Github.com Create account and Sign In.
Then Create A repository
Give Repository a name and click “Create Repository” Button.
You will see some thing like this
In above picture “Test” is the name of repository. And using push command we can uploads files into repository. On GitHub we can make public repositories for free but we will have to pay if we create private repository.