BACK TO
Presented for you by: Tomasz Banasiak
GIT
BASICS
The foundations
WHY GIT AND WHAT'S THE PURPOSE OF THIS TRAINING?
WHY GIT?
-
MOST POPULAR VCS SO FAR
-
FLEXIBLE, EXTENSIBLE
-
HAS NO KNOWN BIG ISSUES
-
FAST & SAFE
-
SCATTERED, DECENTRALIZED
-
LARGE COMMUNITY SUPPORT
WHAT iS THE PURPOSE OF This trainig
-
increase company"S advanced git knowledge
-
Reduce the number of common mistakes
-
Explain not only the order of GIT COMMANDS, but also show you what is happening underneath
The foundations
GIT Architecture
BACK IN 1169..
GIT ARCHITECTURE
GIT ARCHITECTURE
GIT ARCHITECTURE
REPO
git clone REPO
REPO2
origin: NULL
origin: REPO
REPO3
origin: REPO2
WHAT SHOULD YOU KNOW SO FAR
-
WHAT IS ORIGIN
-
Developer's repo is a fully functional copy of ORIGIN
-
Our ORIGIN repos are managed by GitLab
-
If ORIGIN IS BROKEN - you can still commit changes
The foundations
WHATS UNDER THE HOOD
CREATE NEW REPO
git clone git@gitlab:22/devschool/testrepo.git
-
Find or create new GitLab Repo
-
Clone repo into your working directory
REPOSITORY STATE
WORKING DIR GIT INDEX LOCAL REPO REMOTE REPO
REPOSITORY STATE
WORKING DIR GIT INDEX LOCAL REPO REMOTE REPO
git add .
REPOSITORY STATE
WORKING DIR GIT INDEX LOCAL REPO REMOTE REPO
git commit -m "Initial commit"
4ef0374: Initial commit
REPOSITORY STATE
WORKING DIR GIT INDEX LOCAL REPO REMOTE REPO
git add .
4ef0374: Initial commit
REPOSITORY STATE
WORKING DIR GIT INDEX LOCAL REPO REMOTE REPO
git add .
4ef0374: Initial commit
REPOSITORY STATE
WORKING DIR GIT INDEX LOCAL REPO REMOTE REPO
git commit -m "Another commit"
4ef0374: Initial commit
f1f1efd: Another commit
REPOSITORY STATE
WORKING DIR GIT INDEX LOCAL REPO REMOTE REPO
git push origin master
4ef0374: Initial commit
f1f1efd: Another commit
4ef0374: Initial commit
f1f1efd: Another commit
WHAT SHOULD YOU KNOW SO FAR
-
WHAT IS WORKING DIRECTORY
-
WHAT IS GIT INDEX
-
WHEN FILES ARE ADDED TO GIT INDEX?
-
WHAT DOES PUSH DO?
The foundations
STORING FILES
HOW DOES GIT FIND FILE VERSION FOR SPECIFIED REVISION?
Commit: Modified file
Commit: REMOVED OTHER FILE
Commit: ADDED FILE
HOW DOES GIT FIND FILE VERSION FOR SPECIFIED REVISION?
GIT TREE
HOW DOES GIT FIND FILE VERSION FOR SPECIFIED REVISION?
GIT TREE - DIRECTED ACYCLIC GRAPH
WHAT SHOULD YOU KNOW SO FAR
-
HOW IS GIT CONSTRUCTING FILES FROM COMMITS
-
WHAT IS GIT TREE
-
WHY IS THIS BETTER THAN Eg. SVN WAY?
-
WHY IS REVERTING MERGE COMMIT SO PAINFUL?
The foundations
GIT TAGS
TAGS IN GIT
-
TAGS POINTS TO SPECIFIED COMMIT - SO IT'S CONNECTED WITH BRANCH
-
TAG IS SOME KIND OF LABEL
-
YOU CAN "MOVE" TAG BY REPLACING THE POINTER
-
BUT WE DONT RECOMMEND THAT!
-
TAGS ARE VERY HELPFUL ON MASTER BRANCH
TAGS IN GIT
WHAT SHOULD YOU KNOW SO FAR
-
WHAT IS TAG
-
WHATS THE DIFFERENCE BETWEEN TAG AND BRANCH?
-
CAN WE CHANGE TAG?
The foundations
GIT IGNORE & KEEP
GIT IGNORE
-
File name: .gitignore
-
It's a good practice to have only one
-
YOU CAN USE FILE MASKS IN IT
-
GITIGNORE.IO FOR HELP!
GIT IGNORE
nbproject
._*
.~lock.*
.buildpath
.DS_Store
.idea
.project
.puppet
.settings
vendor/
public/vendor/
config/development.config.php
config/autoload/local.php
config/autoload/*.local.php
!public/vendor/README.md
data/cache/
!data/cache/.gitkeep
GIT IGNORE
WHAT SHOULD BE IGNORED?
-
IDE & LOCAL CONFIG FILES
-
ALL APP-GENERATED CONTENT
-
CACHE DIRECTORIES
-
LOGS
-
VENDOR DIRS
GIT KEEP
-
File name: .gitKEEP
-
JUST AN EMPTY FILE
-
GOOD PRACITCE TO PUT DIR DESCRIPTION
-
README.MD as an NICE alternative
WHAT SHOULD YOU KNOW SO FAR
-
WHAT IS GIT IGNORE AND GIT KEEP
-
WHICH FILES SHOULD BE IGNORED?
-
WHY DOESNT GIT KEEP EMPTY DIRS?
-
SHOULD WE IGNORE COMPOSER.lock?
The foundations
QUESTIONS?
The foundations
THANK YOU
GIT - Back to Basics! (RST Internal Course)
By Tomasz Banasiak
GIT - Back to Basics! (RST Internal Course)
- 1,155