SlideShare una empresa de Scribd logo
1 de 21
Descargar para leer sin conexión
Now I get it!!!
> git config --global -l | grep user
user.name=Yoram Michaeli
user.email=yorammi@tikalk.com
http://www.tikalk.com
Version Control System (VCS)
Now I GIT it!!!
GIT origins and start-points
● Created by Linus Torvalds (created Linux as
well)
● Linux kernel project
● Meant to be
○ Fast distributed system
○ Capable of handling large projects
● Command line interface
● Official GIT site: http://git-scm.com
● There are many available GUI tools
> git help
usage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
[-c name=value] [--help]
<command> [<args>]Now I GIT it!!!
Let's GIT started
● Installation - depends on the OS
● Initial global configuration
> git config --global user.name "Bill Gates"
> git config --global user.email bill.gates@microsoft.com
> git config --global color.ui true
Now I GIT it!!!
Let's GIT going
● Start a new empty local repository
> mkdir NowIGitIt
> cd NowIGitIt
> git init
Initialized empty Git repository in ~/Documents/Tikal/git_demo/NowIGitIt/.git/
> git status
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)
Now I GIT it!!!
Common workflow - new file
Now I GIT it!!!
Step Command Output of git status command
Create file locally echo start > First.txt # On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# First.txt
nothing added to commit but untracked files present (use "git add"
to track)
Add file to staging
area
git add First.txt # On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: First.txt
#
Commit changes git commit First.txt -m "First
commit"
output of command:
master (root-commit) 30e3004] First commit
1 file changed, 1 insertion(+)
create mode 100644 First.txt
# On branch master
nothing to commit (working directory clean)
Common workflow - modified file
Now I GIT it!!!
Step Command Output of git status command
Change file locally echo changed > First.txt # On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in
working directory)
#
# modified: First.txt
#
no changes added to commit (use "git add" and/or "git
commit -a")
Commit changes git commit First.txt -m "Second
commit"
output of command:
[[master f1d433f] Second commit
1 file changed, 1 insertion(+), 1 deletion(-)
# On branch master
nothing to commit (working directory clean)
GIT basic file flow
Now I GIT it!!!
GIT log - view history
Now I GIT it!!!
> git log
commit f1d433f5b79a10b9a12dc8277bc9aae62bff0cfa
Author: Yoram Michaeli <yorammi@tikalk.com>
Date: Fri May 3 14:58:51 2013 +0300
Second commit
commit 30e30041fdb8f97751ddc3f99da25a960b6d3b74
Author: Yoram Michaeli <yorammi@tikalk.com>
Date: Fri May 3 14:41:44 2013 +0300
First commit
GIT diff - where things matters...
> echo change2 > First.txt
> git diff
diff --git a/First.txt b/First.txt
index 5ea2ed4..39c5733 100644
--- a/First.txt
+++ b/First.txt
@@ -1 +1 @@
-changed
+change2
Now I GIT it!!!
Regretting what I've done...
Now I GIT it!!!
Action Command Output of git status command
Unstaging a file git reset HEAD First.txt
output of command:
Unstaged changes after reset:
M First.txt
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in
working directory)
#
# modified: First.txt
#
no changes added to commit (use "git add" and/or "git
commit -a")
Discard changes git checkout -- First.txt # On branch master
nothing to commit (working directory clean)
Undoing a commit git reset --soft HEAD^ # On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: First.txt
#
GIT collaboration
Now I GIT it!!!
GIT Repository clone
> git clone https://github.com/tikalk/NowIGitIt.git
● Clone an existing repository as a local
repository
● Clones into current folder
● Can be named differently than the origin
repository
Now I GIT it!!!
Add remote GIT repository
> git remote add origin https://github.com/tikalk/NowIGitIt.git
● Clone command add origin remote
automatically
● More than one remote is possible
● Use git remote remove <name> to remove a
remote
Now I GIT it!!!
Push to a remote repository
> git push -u origin master
● Push changes on local repository into a
remote repository
● Will fail if there are conflicts
● Fast-forward push is the best!
Now I GIT it!!!
Pull from remote repository
> git pull
● Pull changes from remote repository into the
local repository
● Will fail if there are conflicts
● Fast-forward pull is the best!
Now I GIT it!!!
GIT Branching
> git branch unofficial
> git branch
* master
unofficial
> git checkout unofficial
Switched to branch 'unofficial'
> git branch
master
* unofficial
Now I GIT it!!!
GIT Merging
> git checkout unofficial
> echo "Now I GIT it" > README.txt
> git add README.txt
> git commit -m "Add README file"
> git checkout master
> git merge unofficial
Now I GIT it!!!
Add GIT tag
> git tag -a tag1 -m "first tag"
> git tag -a tag2 -m "second tag"
> git tag
tag1
tag2
> git tag -d tag2
> git tag
tag1
Now I GIT it!!!
And if you still don't GIT it...
● Git introduction
● GIT real
● Linus talks about git
Now I GIT it!!!
Now I GIT it!!!

Más contenido relacionado

La actualidad más candente

Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionAnwarul Islam
 
Git - The Incomplete Introduction
Git - The Incomplete IntroductionGit - The Incomplete Introduction
Git - The Incomplete Introductionrschwietzke
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash CourseNilay Binjola
 
Git and fundamentals
Git and fundamentalsGit and fundamentals
Git and fundamentalsNaincy Gupta
 
Git Basics at Rails Underground
Git Basics at Rails UndergroundGit Basics at Rails Underground
Git Basics at Rails UndergroundAriejan de Vroom
 
Git: basic to advanced
Git: basic to advancedGit: basic to advanced
Git: basic to advancedYodalee
 
Git - Get Ready To Use It
Git - Get Ready To Use ItGit - Get Ready To Use It
Git - Get Ready To Use ItDaniel Kummer
 
The Fundamentals of Git
The Fundamentals of GitThe Fundamentals of Git
The Fundamentals of GitDivineOmega
 
Deep dark-side of git: How git works internally
Deep dark-side of git: How git works internallyDeep dark-side of git: How git works internally
Deep dark-side of git: How git works internallySeongJae Park
 

La actualidad más candente (20)

Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training Session
 
Git cli
Git cliGit cli
Git cli
 
Git
GitGit
Git
 
Git - The Incomplete Introduction
Git - The Incomplete IntroductionGit - The Incomplete Introduction
Git - The Incomplete Introduction
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
 
Git Basic
Git BasicGit Basic
Git Basic
 
Git in 5 Minutes
Git in 5 MinutesGit in 5 Minutes
Git in 5 Minutes
 
Git and fundamentals
Git and fundamentalsGit and fundamentals
Git and fundamentals
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
 
GIT_In_90_Minutes
GIT_In_90_MinutesGIT_In_90_Minutes
GIT_In_90_Minutes
 
Git Basics at Rails Underground
Git Basics at Rails UndergroundGit Basics at Rails Underground
Git Basics at Rails Underground
 
Git github
Git githubGit github
Git github
 
Git: basic to advanced
Git: basic to advancedGit: basic to advanced
Git: basic to advanced
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Git - Get Ready To Use It
Git - Get Ready To Use ItGit - Get Ready To Use It
Git - Get Ready To Use It
 
The Fundamentals of Git
The Fundamentals of GitThe Fundamentals of Git
The Fundamentals of Git
 
GIT - GOOD PRACTICES
GIT - GOOD PRACTICESGIT - GOOD PRACTICES
GIT - GOOD PRACTICES
 
Deep dark-side of git: How git works internally
Deep dark-side of git: How git works internallyDeep dark-side of git: How git works internally
Deep dark-side of git: How git works internally
 
01 - Git vs SVN
01 - Git vs SVN01 - Git vs SVN
01 - Git vs SVN
 

Similar a Now i git it!!!

Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptuallyseungzzang Kim
 
Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)Ashok Kumar
 
Learning Basic GIT Cmd
Learning Basic GIT CmdLearning Basic GIT Cmd
Learning Basic GIT Cmdsrinathcox
 
Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHubLucas Videla
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An IntroductionBehzad Altaf
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practiceMajid Hosseini
 
Source Code Management with Git
Source Code Management with GitSource Code Management with Git
Source Code Management with GitThings Lab
 
Git tech talk
Git tech talkGit tech talk
Git tech talkrazasayed
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for ArtistsDavid Newbury
 
Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Brian K. Vagnini
 
GIT in a nutshell
GIT in a nutshellGIT in a nutshell
GIT in a nutshellalignan
 
Git Basics 1 Carenza
Git Basics 1 CarenzaGit Basics 1 Carenza
Git Basics 1 CarenzaPeter Carenza
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitE Carter
 

Similar a Now i git it!!! (20)

Introduction to GIT
Introduction to GITIntroduction to GIT
Introduction to GIT
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptually
 
Loading...git
Loading...gitLoading...git
Loading...git
 
Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)
 
Learning Basic GIT Cmd
Learning Basic GIT CmdLearning Basic GIT Cmd
Learning Basic GIT Cmd
 
Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHub
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practice
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
Source Code Management with Git
Source Code Management with GitSource Code Management with Git
Source Code Management with Git
 
Git tech talk
Git tech talkGit tech talk
Git tech talk
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshell
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for Artists
 
Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615
 
GIT in a nutshell
GIT in a nutshellGIT in a nutshell
GIT in a nutshell
 
Git Basics 1 Carenza
Git Basics 1 CarenzaGit Basics 1 Carenza
Git Basics 1 Carenza
 
Git training v10
Git training v10Git training v10
Git training v10
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Git: Git'ing the Basic
Git: Git'ing the BasicGit: Git'ing the Basic
Git: Git'ing the Basic
 

Más de Yoram Michaeli

Jenkins Pipeline 101 and TCI - presentation and workshop
Jenkins Pipeline 101 and TCI - presentation and workshopJenkins Pipeline 101 and TCI - presentation and workshop
Jenkins Pipeline 101 and TCI - presentation and workshopYoram Michaeli
 
Issue-in-the-middle-here
Issue-in-the-middle-hereIssue-in-the-middle-here
Issue-in-the-middle-hereYoram Michaeli
 
Continuous integration introduction
Continuous integration introductionContinuous integration introduction
Continuous integration introductionYoram Michaeli
 
The Jenkins Pipeline Force Awakens - Jenkins User Conference Tel-Aviv 2018
The Jenkins Pipeline Force Awakens - Jenkins User Conference Tel-Aviv 2018The Jenkins Pipeline Force Awakens - Jenkins User Conference Tel-Aviv 2018
The Jenkins Pipeline Force Awakens - Jenkins User Conference Tel-Aviv 2018Yoram Michaeli
 
הרכב והעתיד The Car and the future
הרכב והעתיד The Car and the futureהרכב והעתיד The Car and the future
הרכב והעתיד The Car and the futureYoram Michaeli
 
The Jenkins pipeline force awakens
The Jenkins pipeline force awakensThe Jenkins pipeline force awakens
The Jenkins pipeline force awakensYoram Michaeli
 
The Jenkins Force Awaken Again @ JAM #6 meetup
 The Jenkins Force Awaken Again @ JAM #6 meetup The Jenkins Force Awaken Again @ JAM #6 meetup
The Jenkins Force Awaken Again @ JAM #6 meetupYoram Michaeli
 
Source-it Version-contol & GIT - floating-lesson
Source-it Version-contol & GIT - floating-lessonSource-it Version-contol & GIT - floating-lesson
Source-it Version-contol & GIT - floating-lessonYoram Michaeli
 
Li liq liqui liquibase
Li liq liqui liquibaseLi liq liqui liquibase
Li liq liqui liquibaseYoram Michaeli
 
Choosing Git hosting service
Choosing Git hosting serviceChoosing Git hosting service
Choosing Git hosting serviceYoram Michaeli
 

Más de Yoram Michaeli (12)

Jenkins Pipeline 101 and TCI - presentation and workshop
Jenkins Pipeline 101 and TCI - presentation and workshopJenkins Pipeline 101 and TCI - presentation and workshop
Jenkins Pipeline 101 and TCI - presentation and workshop
 
Issue-in-the-middle-here
Issue-in-the-middle-hereIssue-in-the-middle-here
Issue-in-the-middle-here
 
Continuous integration introduction
Continuous integration introductionContinuous integration introduction
Continuous integration introduction
 
The Jenkins Pipeline Force Awakens - Jenkins User Conference Tel-Aviv 2018
The Jenkins Pipeline Force Awakens - Jenkins User Conference Tel-Aviv 2018The Jenkins Pipeline Force Awakens - Jenkins User Conference Tel-Aviv 2018
The Jenkins Pipeline Force Awakens - Jenkins User Conference Tel-Aviv 2018
 
הרכב והעתיד The Car and the future
הרכב והעתיד The Car and the futureהרכב והעתיד The Car and the future
הרכב והעתיד The Car and the future
 
The Jenkins pipeline force awakens
The Jenkins pipeline force awakensThe Jenkins pipeline force awakens
The Jenkins pipeline force awakens
 
The Jenkins Force Awaken Again @ JAM #6 meetup
 The Jenkins Force Awaken Again @ JAM #6 meetup The Jenkins Force Awaken Again @ JAM #6 meetup
The Jenkins Force Awaken Again @ JAM #6 meetup
 
Hello DevOps World
Hello DevOps WorldHello DevOps World
Hello DevOps World
 
Source-it Version-contol & GIT - floating-lesson
Source-it Version-contol & GIT - floating-lessonSource-it Version-contol & GIT - floating-lesson
Source-it Version-contol & GIT - floating-lesson
 
Li liq liqui liquibase
Li liq liqui liquibaseLi liq liqui liquibase
Li liq liqui liquibase
 
Choosing Git hosting service
Choosing Git hosting serviceChoosing Git hosting service
Choosing Git hosting service
 
Lets git to it
Lets git to itLets git to it
Lets git to it
 

Now i git it!!!

  • 1. Now I get it!!! > git config --global -l | grep user user.name=Yoram Michaeli user.email=yorammi@tikalk.com http://www.tikalk.com
  • 2. Version Control System (VCS) Now I GIT it!!!
  • 3. GIT origins and start-points ● Created by Linus Torvalds (created Linux as well) ● Linux kernel project ● Meant to be ○ Fast distributed system ○ Capable of handling large projects ● Command line interface ● Official GIT site: http://git-scm.com ● There are many available GUI tools > git help usage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] [-p|--paginate|--no-pager] [--no-replace-objects] [--bare] [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>] [-c name=value] [--help] <command> [<args>]Now I GIT it!!!
  • 4. Let's GIT started ● Installation - depends on the OS ● Initial global configuration > git config --global user.name "Bill Gates" > git config --global user.email bill.gates@microsoft.com > git config --global color.ui true Now I GIT it!!!
  • 5. Let's GIT going ● Start a new empty local repository > mkdir NowIGitIt > cd NowIGitIt > git init Initialized empty Git repository in ~/Documents/Tikal/git_demo/NowIGitIt/.git/ > git status # On branch master # # Initial commit # nothing to commit (create/copy files and use "git add" to track) Now I GIT it!!!
  • 6. Common workflow - new file Now I GIT it!!! Step Command Output of git status command Create file locally echo start > First.txt # On branch master # # Initial commit # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # First.txt nothing added to commit but untracked files present (use "git add" to track) Add file to staging area git add First.txt # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # # new file: First.txt # Commit changes git commit First.txt -m "First commit" output of command: master (root-commit) 30e3004] First commit 1 file changed, 1 insertion(+) create mode 100644 First.txt # On branch master nothing to commit (working directory clean)
  • 7. Common workflow - modified file Now I GIT it!!! Step Command Output of git status command Change file locally echo changed > First.txt # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: First.txt # no changes added to commit (use "git add" and/or "git commit -a") Commit changes git commit First.txt -m "Second commit" output of command: [[master f1d433f] Second commit 1 file changed, 1 insertion(+), 1 deletion(-) # On branch master nothing to commit (working directory clean)
  • 8. GIT basic file flow Now I GIT it!!!
  • 9. GIT log - view history Now I GIT it!!! > git log commit f1d433f5b79a10b9a12dc8277bc9aae62bff0cfa Author: Yoram Michaeli <yorammi@tikalk.com> Date: Fri May 3 14:58:51 2013 +0300 Second commit commit 30e30041fdb8f97751ddc3f99da25a960b6d3b74 Author: Yoram Michaeli <yorammi@tikalk.com> Date: Fri May 3 14:41:44 2013 +0300 First commit
  • 10. GIT diff - where things matters... > echo change2 > First.txt > git diff diff --git a/First.txt b/First.txt index 5ea2ed4..39c5733 100644 --- a/First.txt +++ b/First.txt @@ -1 +1 @@ -changed +change2 Now I GIT it!!!
  • 11. Regretting what I've done... Now I GIT it!!! Action Command Output of git status command Unstaging a file git reset HEAD First.txt output of command: Unstaged changes after reset: M First.txt # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: First.txt # no changes added to commit (use "git add" and/or "git commit -a") Discard changes git checkout -- First.txt # On branch master nothing to commit (working directory clean) Undoing a commit git reset --soft HEAD^ # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: First.txt #
  • 13. GIT Repository clone > git clone https://github.com/tikalk/NowIGitIt.git ● Clone an existing repository as a local repository ● Clones into current folder ● Can be named differently than the origin repository Now I GIT it!!!
  • 14. Add remote GIT repository > git remote add origin https://github.com/tikalk/NowIGitIt.git ● Clone command add origin remote automatically ● More than one remote is possible ● Use git remote remove <name> to remove a remote Now I GIT it!!!
  • 15. Push to a remote repository > git push -u origin master ● Push changes on local repository into a remote repository ● Will fail if there are conflicts ● Fast-forward push is the best! Now I GIT it!!!
  • 16. Pull from remote repository > git pull ● Pull changes from remote repository into the local repository ● Will fail if there are conflicts ● Fast-forward pull is the best! Now I GIT it!!!
  • 17. GIT Branching > git branch unofficial > git branch * master unofficial > git checkout unofficial Switched to branch 'unofficial' > git branch master * unofficial Now I GIT it!!!
  • 18. GIT Merging > git checkout unofficial > echo "Now I GIT it" > README.txt > git add README.txt > git commit -m "Add README file" > git checkout master > git merge unofficial Now I GIT it!!!
  • 19. Add GIT tag > git tag -a tag1 -m "first tag" > git tag -a tag2 -m "second tag" > git tag tag1 tag2 > git tag -d tag2 > git tag tag1 Now I GIT it!!!
  • 20. And if you still don't GIT it... ● Git introduction ● GIT real ● Linus talks about git Now I GIT it!!!
  • 21. Now I GIT it!!!