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:
git init
This command has the function to create a new local repository. This command will create a new folder called “.git”
Example : $ git init
git status
This command has a function to see the status of the local repository.
Contoh :$ git status
git add
This command has a function to add files to the repo that was previously created.
Contoh : $ git add myfile.txt
git commit
This command has the function to save all changes that occur.
Contoh : $ git commit -m "first commit"
git remote
This command has the function to add a new remote repository.
Contoh : $ git remote add origin git@bitbucket.org:xxxxx/xxxxx.git
git pull / push
This command has the function to store and retrieve data from the remote repo.
Contoh : $ git pull origin master
$ git push origin master
git diff
This command has a function to compare file changes.
Contoh : $ git diff
git reset
This command has a function to cancel changes on the local repo.
– Contoh : $ Git reset --soft HEAD^ (Lokal)
$ Git reset --hard /
git Clone
This command has the function to clone jobs that already exist locally.
– Contoh : $ git clone git@bitbucket.org:xxxxx/xxxxx.git
git merge
This command has the function to merge between branches.
git checkout
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