- 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?
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.
Checkout if you have git:
$ git --version
Add a local Git repository:
$ git init
$ 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.
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.
Create a new branch called testing:
$ git branch testing
It keeps a special pointer called HEAD.
To switch to an existing branch:
$ git checkout testing
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
Clone it to your location:
$ git clone [repository url].git
To make sure your folder project is updated:
$ git pull origin master
Our GitLab server: https://gitlab.hpc.unt.edu/gitlab/
Single file with all commands presented
Official Git: https://git-scm.com
Documentation: https://git-scm.com/book/en/v1/Getting-Started
YouTube: https://www.youtube.com/watch?v=uUuTYDg9XoI
Other refferences:
https://en.wikipedia.org/wiki/Git
https://medium.freecodecamp.org/what-is-git-and-how-to-use-it-c341b049ae61