• What is Git
  • Open Source Distributed Version Control System
  • Why Git is needed
  • Navigate Git
    • Staging and Committing the code
    • Branches
    • Merging
  • Git on the Server
  • Talon GitLab
  • Get started
  • Where is it usefull?

What is Git

  • Git is a distributed version-control system for tracking changes in source code during software development.
  • It is designed for coordinating work among programmers, but it can be used to track changes in any set of files.
  • Its goals include speed, data integrity, and support for distributed non-linear workflows.

Open Source Distributed Version Control System

  • Control System: Git is a content tracker tha can be used to store content. It is mostly used to store code due to the features it provides.

  • Version Control System: The code which is stored in Git keeps changing as more code is added and code can be added in parallel. Maintaining a history of what changes have happened. Git also provides features like branches and merges.

  • Distributed Version Control System: Git has a remote repository stored on a server and a local repository stored on the computer of each user. This means that the code is not just stored on a central server, but the full copy of the code is present on all users computers.

Why Git is needed

  • Git is needed to ensure there are no code conflicts between users/developers.
  • Allows users/developers to revert and go back to an older version of the code.
  • Sometimes several projects which are being run in parallel involve the same codebase. In such a case, the concept of branching in Git is very important.

Navigate Git

Staging and Committing the code

  • Staging area keeps track of all the files which are to committed. Any file which are not added to the staging area will not be committed. This gives control over which files need to be committed.
  • Committing is the process in which the code is added to the local repository. Before committing the code, it has to be in the staging area.


$ git add file
  • Add multiple files:

    $ git add file1 file 2
  • Add all the files inside your project folder:

    $ git add .


  • To commit the file:

    $ git commit -m "your message"
  • Enter a relevant commit message to indicate what code changes were done in that particular commit.

Status and Log

  • Find out information regarding what files are modified and what files are in the staging area:

    $ git status
  • Print out all the commits which have been done up until now:

    $ git log

    The log shows the author of each commit, the date of the commit, and the commit message.


A branch is a lightweight movable pointer in the Git repository.

The default branch name in Git is master.

What happens if you create a new branch?

  • Creates a new pointer for you to move around.
  • Create a new branch called testing:

    $ git branch testing

    This creates a new pointer at the same commit you’re currently on

How does Git know what branch you’re on?

  • It keeps a special pointer called HEAD.

  • To switch to an existing branch:

    $ git checkout testing

Why are multiple branches needed?

  • Multiple branches are needed to support multiple parallel developments.

  • You can list out all the branches in local using the following command:

    $ git branch


  • Currently, Master Branch is ahead of the Test by 1 commit. Let’s say that now we want all the code in the Master Branch to be brought back to the Test Branch. This is where git merge is very useful.

    First go back to the master branch:

    $ git checkout master

    Then run the merge command:

    $ git merge test

Git on the Server

  • Until now, we’ve been working in the local repository but eventually, you will push the code into a remote repository.
  • Once the code is in the remote repository, other’s can see and some can even modify that code if granted access.
  • Here is where GitLab comes in play: It provides a central source where everyone can see your commits. This is where we have different platforms: GitLab, GitHub, Bitbucket.

Talon GitLab https://gitlab.hpc.unt.edu/gitlab/

  • See your projects.
  • Create your own projects.
  • See other public projects.
  • Reuse code.

Get started

  • Create a new project on https://gitlab.hpc.unt.edu/gitlab/
  • Clone it to your location:

    $ git clone [repository url].git
  • To make sure your folder project is updated:

    $ git pull origin master

Where is it usefull?

  • Advisor - student
  • Advisor - his lab students
  • Student - students
  • Advisor - Advisor
  • Share data, code, progress, documenation, templates and more.

Git Snippet

Thank you!