1st Step to GIT
Before learning GIT i think it is better to understand what Version Control System(Source control) is,Version Control System-
Version control system is a tool which we used to tack changes of collection of data on time, By using version control we can track what are the exact changes we have done in specific time and, we can undo those changes or we can re-check those changes by versioning history, and we can find out who have done the changes or when it was done, and also we can host our files(Code, document or etc...) can access to those files anywhere from a a any device, yeah you are right! it's pretty cool isn't it, altogether we can say it is Version Control.
Now lets see what is GIT, How it works and How we can use that for our projects?
What is Git and How we can install Git?
GIT is a famous and powerful version controlling tool use by software engineers, writers , project managers and many more, 1st of all we have to install git on our PC, you can install git by surfing their website or you can install git from command prompt by typing the installation command.
After installation you can verify, if the installation success or not by typing git --version on command prompt, if the installation done successfully you may see git version on your command prompt. Now you can configure git and create a local repository lets see how can we do that,
How to configure git?
Now you have to select a file location on your computer and open command prompt inside that file and type git init , from that command git will create .get sub directory inside your local repository folder with git meta data. This means you are ready to host this code on a hosting provider.
have completed the 1st step, now we have to find out one Code Hosting Provider, There are some famous code hosting provider services ,you can choose one of them,
- GitHub
- Bitbucket
- GitLab
- GForge
- GNU Savannah, and there are lot more
You have to create an account using one of these hosting provider sites and have to link that account with local git tool , now you can ADD your project files to host storage by typing git add . (git<space>.<dot>)
Now we have to push out 1st commit to git by typing git commit -m "first commit" and press enter, after you press enter your files in specific location will commit with message "first commit".
After that we have to link our local repository with remote repository by typing git remote add origin https://github.com/projrct-name.git
Now we have to push out 1st commit to git by typing git commit -m "first commit" and press enter, after you press enter your files in specific location will commit with message "first commit".
After that we have to link our local repository with remote repository by typing git remote add origin https://github.com/projrct-name.git
now can collaboratively work with other team members . If we give them correct credentials, each and every team member can access those project code base anywhere in the world and any device.
Here i mention several useful git commands-
Create a file name README.md with Readme content content | echo "Readme content" >> README.md |
| List the files you've changed and those you still need to add or commit | git status |
| Add all or one file to staging | git add . OR git add file_name |
| Commit changes to head with message | git commit -m 'message' |
Commit any files you've added with git add, and also commit any files you've changed since then | git commit -a |
| Send all commits from local repository to remote repository | git push |
Do a git push and sets the default remote branch for the current local branch. So any future git pull command will attempt to bring in commits from the <remote-branch>into the current local branch | git push -u <remote-branch> |
| Send changes to the master branch of your remote repository | git push origin master |
| Push a specific branch to your remote repository | git push origin <branch_name> |
| Push all branches to your remote repository | git push --all origin |
git help- You can find out useful git commands by typing this command on the prompt
Conclusion
git is very famous and powerful source control tool you small projects as well as very large projects. and also it is very easy to learn.I think this article will help you guys to start to learn git more enthusiastically.
Conclusion
git is very famous and powerful source control tool you small projects as well as very large projects. and also it is very easy to learn.I think this article will help you guys to start to learn git more enthusiastically.


Comments
Post a Comment