This is quick tutorial on how to use capabilities of GIT tools for software development in a team.
-
- To access the GIT repository:
- Add your Git username and set your email
- To get BmnRoot GIT repository, use this command
- To download the latest changes in the project
- To view all branches in the project
- To work on an existing branch
- To create a new branch and start working with it
- To add (stage) a modified or new file, or folder in your branch
- To view the changes you have made
- View differences
- To commit all changes (staged files) that you made in local machine GIT repository
- To save the changes in remote server machine GIT repository (origin branch)
- When you want to merge your NAME-OF-BRANCH with protected dev branch, create merge request on the GitLab site for BmnRoot. Then if your branch has passed the testing without errors, you can merge branches by clicking the button on the site.
Register on the JINR GitLab site with @jinr.ru mail or send an email to Konstantin Gertsenberger with a description of your work and preferred login.
Add SSH key in your personal gitlab profile!To get zip archive (BmnRoot development version) without registration and SSH keys (only for read):
BmnRoot archive
It is important to configure your Git username and email address, since every Git commit will use this information to identify you as the author.
On your shell, type the following command to add your username:
git config --global user.name "YOUR_USERNAME"
To set your email address, type the following command:
git config --global user.email "your_email_address@example.com"
To view the information that you entered, along with other global options, type:
git config --global --list
git clone --recursive git@git.jinr.ru:nica/bmnroot.git
git pull
git branch -r
To switch to an existing branch, so you can work on it:
git checkout NAME-OF-BRANCH
Please use names for branches in accordance with the task for common understanding, like: feature-new-geometry or bugfix-old-problem. Spaces will not be recognized in the branch name, so you will need to use a hyphen or underscore.
git checkout -b NAME-OF-BRANCH
git add NAME-OF-FILE
It is important to be aware of what's happening and the status of your changes. When you add, change or delete files/folders, Git knows about it. To check the status of your changes:
git status
To view the differences between your local, unstaged changes and the repository version that you cloned or pulled, type:
git diff
git commit -m "Some comments add here"
git push origin NAME-OF-BRANCH
--
If something went wrong
-
- Delete all changes in the local Git repository
- Unstage all changes that have been added to the staging area
To delete all local changes in the repository that have not been added to the staging area, and leave unstaged files/folders, type:
git checkout .
To undo the most recent add, but not committed, files/folders:
git reset .
--
-
- GIT software for Windows download here
For example: Tortoise git client
- Full GIT Documentation
http://git-scm.com/book/ru/v1
http://githowto.com/ru