Today I am writing about git that how setup git and how this will helpful in development. we will use GitHub to show you demo how to use git with github.com.
why use git
git very useful to manage versions of your projects that we can say git is version controlling tool. If you have built something and commit your code to git repository hosting service ( ex: GitHub, Bitbucket, codebase etc.) and push the code. if you change in your existing project and your project is not working so you can get you previous version code from GitHub. So we will discuss the git command in this post. We are using GitHub to show how git commands work with the example.
Install git tool on your Machine
Go to the download page of git-scm or open this link in your browser ( https://git-scm.com/downloads ). git is compatible with all operating system choose which OS you are using and install as usual all software install.
Setup GitHub Account
If you already registered with GitHub then login otherwise Sign up for GitHub at https://github.com/
Follow these basic step to create a repository by clicking + icon on the top or into profile drop-down.
- Enter Repository name
- Give description
- Checked Initialize this repository with a README.md file
- Create repository
after creating repository this page will show with README.md file with commit message “initial commit”. The main things to know the clone URL. click on clone or download button then there will be a box appears in this box a https URL in the input box and just click on copy button.
Now open git bash command line interface and going to D:\github directory and pass this command.
git clone https://github.com/iamnewbieblog/git-demo.git
Now go to that cloned directory and paste your project file there. after that run this command to check status.
there will show Untracked files with red colors. To add all files into commit pass this command
git add .
After passing the command git add . will all files in current commit process and if you pass git status command then all Untracked file will show with green colors.
Now all good and make a commit message to this version. type this command.
git commit -m "type here your commit message"
after this command pass a push command to push on GitHub server.
git push origin master
Now your files onGitHubb servers and there is a screenshot. you can see there are count 2 commits, 1 branch, 0 releases and 1 contributor.
this is basic talk about git and GitHub. So, if you have any problem to getting started with this then comment below. And if you seems wrong in this post so please let me know. Thanks.