This is quick tutorial on how to use capabilities of GIT tools for software development in team.

You can download repository zip archive without registration and SSH keys (only for read) here: MpdRoot archive

1. To access the GIT repository:

  • Register on the JINR GitLab site with @jinr.ru mail.
  • Add SSH key in your personal Gitlab profile!
  • Add your Git username and set your email

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

2. To get a GIT repository use this command

git clone git@git.jinr.ru:nica/mpdroot.git

3. To download the latest changes in the project

git pull

4. To view all branches in the project

git branch -r

5. To work on an existing branch

git checkout NAME-OF-BRANCH

6. To create a new branch and start working with it

Please use names for branches in accordance with the task for common understanding, like: feature-new-geometry or bugfix-old-problem. Spaces won’t be recognized in the branch name, so you will need to use a hyphen or underscore.

git checkout -b NAME-OF-BRANCH

7. To add new file or folder in your branch

git add NAME-OF-FILE

8. To add all new files or folders in your branch

git add .

9. To view the changes you’ve made

It’s 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

10. View differences

To view the differences between your local, unstaged changes and the repository versions that you cloned or pulled, type:

git diff

11. To save all changes that you made in local machine GIT repository

git commit -am "Some comments add here"

12. To save the changes in remote server machine GIT repository (origin branch)

git push origin NAME-OF-BRANCH

13. If you want merge NAME-OF-BRANCH with protected dev branch create merge request on GitLab site for MpdRoot. Then if your branch has passed the testing without errors and approval of CodeOwners, your code might be merged.

If something went wrong

14. Delete all changes in the local Git repository

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 .

15. Unstage all changes that have been added to the staging area

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
  • How To use GIT
http://githowto.com/ru
Categories: Posts