How to use GIT

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

    1. To access the GIT repository:
    2. Register on the JINR GitLab site with 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
    3. Add your Git username and set your email
    4. 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 "YOUR_USERNAME"

      To set your email address, type the following command:

      git config --global ""

      To view the information that you entered, along with other global options, type:

      git config --global --list
    5. To get BmnRoot GIT repository, use this command
    6. git clone --recursive
    7. To download the latest changes in the project
    8. git pull
    9. To view all branches in the project
    10. git branch -r
    11. To work on an existing branch
    12. To switch to an existing branch, so you can work on it:

      git checkout NAME-OF-BRANCH
    13. To create a new branch and start working with it
    14. 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
    15. To add (stage) a modified or new file, or folder in your branch
    16. git add NAME-OF-FILE
    17. To view the changes you have made
    18. 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
    19. View differences
    20. To view the differences between your local, unstaged changes and the repository version that you cloned or pulled, type:

      git diff
    21. To commit all changes (staged files) that you made in local machine GIT repository
    22. git commit -m "Some comments add here"
    23. To save the changes in remote server machine GIT repository (origin branch)
    24. git push origin NAME-OF-BRANCH
    25. 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.

If something went wrong

    1. Delete all changes in the local Git repository
    2. 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 .
    3. Unstage all changes that have been added to the staging area
    4. To undo the most recent add, but not committed, files/folders:

      git reset .