2. Introduction
What is Git?
• Git is a version control system for tracking changes in computer files and
coordinating work on those files among multiple people. It is primarily used for
source code management in software development, but it can be used to keep
track of changes in any set of files. As a distributed revision control system it is
aimed at speed, data integrity, and support for distributed, non-linear workflows.
Source: https://en.wikipedia.org/wiki/Git
8. Installation
● Windows: Download installer at https://git-scm.com/download/win
● Linux (Fedora or any closely-related RPM-based distro such as RHEL or
CentOS):
sudo dnf install git-all
● Linux (Debian-based distribution like Ubuntu):
sudo apt-get install git-all
10. Tell Git
who you are
Configure the author name and email
address to be used with your
commits.
Note that Git strips some characters
(for example trailing periods) from
user.name.
git config --global user.name "Sam Smith"
git config --global user.email sam@example.com
12. Check out a
repository
Create a working copy of a local
repository
git clone
https://example@gitlab.co.id/binar/session1/
exampleProject.git
13. Add File
Add one or more files to staging
(index)
git add <filename>
Ex: git add src/Main.java
git add *
14. Commit
Commit changes to head (but not yet
to the remote repository)
git commit -m "Commit message"
15. Push
Send changes to the branch of your
remote repository
git push origin <branch>
Ex: git push origin master
16. Pull
Fetch and merge changes on the
remote server to your working
directory
git pull
17.
18. Standard Git Workflow
Given Git's focus on flexibility, there is no standardized process on
how to interact with Git.
Source: https://www.atlassian.com/git/tutorials/comparing-workflows
19. What is a successful Git
workflow?
When evaluating a workflow for your team, it's most important that you
consider your team’s culture. You want the workflow to enhance the
effectiveness of your team and not be a burden that limits productivity.
Some things to consider when evaluating a Git workflow are:
1. Does this workflow scale with team size?
2. Is it easy to undo mistakes and errors with this workflow?
3. Does this workflow impose any new unnecessary cognitive overhead to
the team?
Source: https://www.atlassian.com/git/tutorials/comparing-workflows
20. Workflows using Git
These workflows are designed to be Guidelines rather than Concrete Rules:
• Centralized Workflow
• Feature Branch Workflow
• Gitflow Workflow
• Forking Workflow