Git Introduction for beginners. Based on the Atlassian git tutorial.
git init, add, commit, push, pull, remote.
introduction to version controls.
git is a software version control and team management tool.
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Git introduction for Beginners
1. Introduction to
Git version control
Gathered and Presented by: Morteza Taghaddomi
Edited by: Mohammad Amin Parchami
Based on: www.atlassian.com/git/tutorials
All content is licensed under the Creative Commons Attribution 2.5 Australia License.
2. K. N. Toosi University of Technology
System Analysis and Design
Dr. Mehdi Esnaashari
Computer Engineering (Artificial Intelligence)
Fall 2020
4. ● What is version control system?
● Benefits of version control systems
● What is git?
● Why Git for your organization?
○ Git for Developers
● What is Repository?
● Initializing a new repository
● Saving changes to the repository
● Not remembering your changes?
● Practice 1
Outline
4/54
5. ● .gitignore
● Collaborating
○ Git remote
■ The origin Remote
○ git clone
○ git push
○ git pull
● summary
● Practice 2
● You do not want to miss out on these
Outline
5/54
8. What is Version Control?
● A category of software tools that help a software team manage
changes to source code over time.
● Keeps track of every modification to the code in a special kind of
database.
○ If a mistake is made, developers can turn back the clock and
compare earlier versions of the code to help fix the mistake
while minimizing disruption to all team members.
8/54
9. Benefits of version control systems
● Developing software without using version control is risky,
like not having backups.
● It enables developers to move faster.
● It Allows software teams to preserve efficiency and agility as
the team scales to include more developers.
9/54
10. Benefits of version control systems
● A complete long-term modification history of every file
○ Changes by whom, when and why!
● Branching and merging
○ Handles Conflicts
● Traceability
○ Jira
10/54
13. What is Git?
● Git is the most widely used modern version control system in the
world today.
● An open-source project originally developed in 2005 by Linus Torvalds.
● Every developer's working copy of the code is also a repository that can
contain the full history of all changes.
● Git has been designed with performance, security and flexibility in
mind. 13/54
14. Why Git for your organization?
● Git for developers
● Git for marketing
● Git for product management
● Git for designers
● Git for customer support
● Git for human resources
● Git for anyone managing a budget
14/54
16. Git for Developers
● Feature Branch Workflow
One of the biggest advantages of Git
is its branching capabilities. Unlike
centralized version control systems,
Git branches are cheap and easy to
merge. This facilitates the feature
branch workflow popular with many
Git users.
16/54
17. Feature Branch Workflow
● When a developer wants to start
working on something—no
matter how big or small—they
create a new branch. This
ensures that the master branch
always contains
production-quality code.
17/54
18. Feature Branch Workflow
● They let you represent
development work at the
same granularity as your
agile backlog.
18/54
20. Pull Requests
● A pull request is a way
to ask another
developer to merge
one of your branches
into their repository.
20/54
21. Pull Requests
● This not only makes it easier for
project leads to keep track of
changes, but also lets developers
initiate discussions around their work
before integrating it with the rest of
the codebase.
21/54
22. Pull Requests
● When a developer gets stuck with a hard
problem, they can open a pull request to
ask for help from the rest of the team.
● junior developers can be confident that
they aren’t destroying the entire project
by treating pull requests as a formal code
review.
22/54
24. Faster Release Cycle
● These capabilities facilitate an
agile workflow where
developers are encouraged to
share smaller changes more
frequently.
● In turn, changes can get pushed
down the deployment pipeline
faster
24/54
25. Git Concepts
● So far we learned what is a Version Control System (VCS),
what is Git, why should we learn it and what are its usages.
● Now we look deeper into its core features.
25/54
26. Repository
● What is a repository?
● Initializing a new Git repository
● Committing a modified version of a file to the repository
● Cloning an existing Git repository
● Configuring a Git repository for remote collaboration
● Common Git version control commands
26/54
27. What is a Git repository?
● A Git repository is a virtual
storage of your project.
● It allows you to save versions of
your code, which you can
access whenever needed.
27/54
28. Initializing a new repository: git init
● To create a new repository,
you'll use the git init command.
● git init is a one-time command
you use during the initial setup
of a new repository.
28/54
29. Initializing a new repository: git init
● Executing this command will
create a new .git subdirectory
in your current working
directory.
● This will also create a new
master branch.
29/54
30. ● It can be used to convert an existing,
unversioned project to a Git repository or
initialize a new, empty repository.
● Executing git init creates a .git subdirectory
in the current working directory, which
contains all of the necessary Git metadata
for the new repository.
Initializing a new repository: git init
30/54
31. Saving changes to the repository:
git add and git commit
● git add: adds a change in the working
directory to the staging area. It tells Git
that you want to include updates of a
particular file.
● git commit: captures a snapshot of the
project's currently staged changes.
31/54
32. Saving changes to the repository:
git add and git commit
git add, git status, and git commit
are all used in combination to
save a snapshot of a Git project's
current state.
32/54
33. Saving changes to the repository:
Instructions:
● git add file1 file2 ...
● git add -a
● git add .
● git add *.py
● git commit -m "my clear and to-the-point commit message"
● git status
● git log
● git log --oneline
33/54
35. Practice 1
1. Make a new folder.
2. Create a new repository.
3. Add new files to the directory.
4. Save the change to the repository.
● check repo status after each level.
35/54
36. .gitignore
● Ignored files are tracked in a special file named .gitignore
that is checked in at the root of your repository.
● Usually log files, IDE settings and environment variables
should ignored.
● Configuring it right at the beginning may save you some
time! 36/54
38. Git remote
The git remote command
lets you create, view, and
delete connections to
other repositories.
38/54
39. Add remote connection
● git remote add <name> <url>
● Create a new connection to a remote
repository.
● After adding a remote, you’ll be able to
use as a convenient shortcut for in other
Git commands.
39/54
40. git clone
● git clone <url>
● git clone is primarily used to point
to an existing repo and make a
clone or copy of that repo at in a
new directory, at another location.
40/54
41. The origin Remote
● When you clone a repository
with git clone, it automatically
creates a remote connection
called origin pointing back to
the cloned repository.
41/54
42. git push
● The git push command is used to
upload local repository content
to a remote repository.
● Pushing is how you transfer
commits from your local
repository to a remote repo.
42/54
43. git push
● git push is most commonly used to
publish an upload local changes to a
central repository.
● After a local repository has been
modified a push is executed to share
the modifications with remote team
members.
● git push can be considered as an
“upload” command
43/54
46. git pull
● git pull command is used to fetch and
download content from a remote
repository,
● and immediately update the local
repository to match that content.
● becoming aware of latest changes,
new branches, etc.
46/54
53. Practice 2
1. Save your change from practice 1, to a remote
repository such as gitlab, github or bitbucket.
2. Add some changes to it.
3. Add new changes from another repository.
4. Sync local repository with remote repository.
53/54
54. You do not want to miss out on these
● Efficient ways of solving conflicts.
● Git cheat sheet
54/54