In software development, Git is a distributed revision control and source code management (SCM) system with an emphasis on speed. Initially designed and developed by Linus Torvalds for Linux kernel development, Git has since been adopted by many other projects.
Every Git working directory is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server.
Git is a very popular control system that is used by developers. It is used to combine work for each developer into one project and maintain it.
Most commonly used commands:
If you have already created a git repo - To clone an existing repo:
git clone ssh://firstname.lastname@example.org:22/home/repos/website/ project_folder where
ssh://email@example.com:22/home/repos/website/ - url address of repo,
project_folder – folder where project will be set.
If you have an empty repo and would like to push the project:
Go to the project root and fire command:
– create an empty local repo.
Then add all files to it by,
git add .
– “.” corresponds to all files, but you can add exact files and folders
After that, you can create a local commit:
git commit –m “First commit”
“First commit” message for commit
To link your local repo with repo on the server fire command:
git remote add origin ssh://firstname.lastname@example.org:22/home/repos/website/
- where origin-name of server.
And finally to push changes on the server:
git push origin master
– where master – default branch, which can be changed.
Now your repo on the server is updated. If you want to get changes from server:
git pull origin master – get changes from server origin and branch master.
If you want to move your repo to another url address:
git remote set-url origin ssh://email@example.com:22/home/repos/website/.
These simple commands will help you to maintain projects created by developers. And, if there are conflicts you can fix them using the merge tools. This way you can compare two versions of the same files and combine them into one which will be your final version.
See also: How to create a jQuery plugin