Objective of the document is to describe how to start manually with command lines a development project, from an existing GIT repository.
Usage of GIT protocol for software development empowers projects team management. It is intended to ease source code management in terms of versioning, branching and sharing between all team members.
GIT platform Architecture
GIT is a distributed version control system, it means developers can share source code from their workstation to others without the need of any centralized repository. However, at dbi-services we made the choice to deploy a centralized repository platform, first in order to avoid manual synchronization between all developers, then to benefit from a shared common project collaboration platform, like GitHub or GitLab.
Prior being allowed to make a push request to centralized repository, a developer must first ensure having got latest source code revision into its local workstation’s repository (pull request). Then he can commit locally his changes, eventually correct merge conflicts, and finally make the push request to centralized platform.
Manual / Command line management
This section will demonstrate how to initiate developer’s local source code management with a remote GIT repository, (as well as from a collaboration platform like GitLab), using the command line.
These commands run out of the box in a Linux operating system.
Under Windows, you must install “git-bash” application.
There are 2 cases for a project initialization:
– Starting a project from your source code
– Getting source code from a shared repository
First of all a GIT repository has to be created in the GIT collaboration platform. Do ask GIT platform’s administrators for project creation.
Before starting, it is recommended to update your GIT personal information:
git config --global user.name “user“
git config --global user.email “email@example.com“
Check status of your GIT configuration:
git config –list
Project initialization from local source code
First you must go to your project folder. It is recommended to have the “src” folder underneath.
GIT repository initialization:
Create a “master” branch on your local and on remote GIT repository
For local branch creation, you will need to add and commit something (like a README.txt file):
git add README.txt
git commit -m “adding README.txt“
For remote branch creation, you must first create the local branch, add the remote repository “origin”, then make a pull request to shared repository:
git remote add origin http://<your git server>/<your repo>.git
git push origin master
“origin” represents a pointer name to remote repository.
Project initialization getting source code from shared repository
Get source code from the repository:
git clone http://<your git server>/<your repo>.git <your destination folder>
Congratulations, you are now ready to use GIT with your new project !