In this tutorial we would like to share about Git introduction. This is one part of the Git and Gitlab training materials at Telkomsel’s office in Jakarta.
This training is at the request of Telkomsel to share the experience of using Git and Gitlab, especially when implemented in the development of system projects that are often held by Profio Teknova Indonesia. Indeed, since we were founded, which is almost 2 years ago, we have immediately implemented a work system using Repository (GIT). It is proven that this is a quite powerful way when we do development projects together.
Git is a tool that functions as a Version Control System (VCS) or changes tracker on files. This tool itself is made by the person who created the Linux Kernel, namely Linus Torvalds. He is the originator of the git that we use now.
Git was created in 2005 when bitkeeper began to crack and linux creators had to find other alternatives to support the development of the linux kernel. By using Git, everyone in a team can make changes to the source code without having to fear of conflicts or difficulties in combining the results of the code changes they make.
By using Git, any changes to the source code will be tracked, namely about what was changed, who changed it, and when it changed.
Let’s try to get acquainted with the basic commands that are often used when working using a repository system:
This command has the function to create a new local repository. This command will create a new folder called “.git”
$ git init
This command has a function to see the status of the local repository.
$ git status
This command has a function to add files to the repo that was previously created.
$ git add myfile.txt
This command has the function to save all changes that occur.
$ git commit -m "first commit"
This command has the function to add a new remote repository.
$ git remote add origin firstname.lastname@example.org:xxxxx/xxxxx.git
git pull / push
This command has the function to store and retrieve data from the remote repo.
$ git pull origin master
$ git push origin master
This command has a function to compare file changes.
Contoh : $ git diff
This command has a function to cancel changes on the local repo.
– Contoh :
$ Git reset --soft HEAD^ (Lokal)
$ Git reset --hard /
This command has the function to clone jobs that already exist locally.
– Contoh :
$ git clone email@example.com:xxxxx/xxxxx.git
This command has the function to merge between branches.
This command has a function to move branches.
Here is a lifecycle from Git.
Recomendation: Sending Email Tutorial using PHP Mailer and Google’s SMTP