SlideShare una empresa de Scribd logo
1 de 33
Descargar para leer sin conexión
git-advanced
@peter_v 2015-10-08
@RIAnalytics hackaton
disclaimer
● from the trenches
● opiniated (git cherry-pick)
● not complete
● going deep (feel free to disconnect)
contents
● always start with “Why ?”
● GitX and other GUI’s
● fundamentals
● git init, git status, git add -i, git commit
● git remote -v, git init --bare
● git branch -a, git merge, git rebase -i
● git cherry-pick, git log --author
WHY ? (peter_v)
● I <3 git , because now = ∅ + Σ commits
● I was there too, so maybe this helps ?
detached head ???
WHY ? (Linus)
Ref https://git-scm.com/book/ca/v1/Comencem-A-Short-History-of-Git
GUI’s for git
● multi-OS : Tower, Github, SourceTree …
● Mac : GitX-dev (rowanj fork)
● Linux : gitk
● I use GitX-dev + command line
● overview (next pages):
https://git-scm.com/downloads/guis
GUI’s for git (2)
GUI’s for git (3)
GitX on spark 1.4 : clean - linear
GitX on Rails 4.1 - “creative chaos” ...
remoteremote
fundamentals
working dir
index
repository
remote(s)
git add
git commit
git push
git checkout
git fetch
origin
git merge
⇐ NON-local
⇐ ALL local
upstream
git init
$ git init git-advanced
● creates a repository in ../.git
● interesting: config, hooks, logs, refs
● does a local git checkout
● all state is inside the dir (mv, tar, cp -r, …)
after git init (1)
after git init (2)
working dir
index
repository
remote
git add
git commit
git push
git checkout
git fetch
origin
git merge
after git init (3) - GitX
git status
$ git status
● “safe” command (always first)
● files/changes NOT yet in index => red
● files/changes in index => green
$ alias gst=’git status’
git status
before git add
working dir
index
repository
remote
git add
git commit
git push
git checkout
git fetch
origin
git merge
git add -i
$ git add -i
● fine grained control of commits
● always do “4” first
GOTCHA => new files not shown $%#!
(“untracked files”)
git add -i (GOTCHA new files)
git add -i : the beautiful part :-)
git add -i : partial add of “commands”
git status after partial git add
git diff
working dir
index
repository
git diff
git diff --cached
git commit
● what really is it ??
● identified by a recursive sha (long, short 7)
● relative: a DIFF between “parent” and “this”
● absolute: ∅ + Σ (parent) commits
● only 1 parent ? NO (merge, non fast-forward)
after git commit
git commit --amend
git remote
● git remote -v
● on server
○ mkdir git-advanved.git
○ cd git-advanced.git
○ git init --bare .
● git remote add origin peter_v@10.1.1.250:
/data/git/git-advanced.git
git branch
* git branch -a
* git pull = git fetch + git merge
* git rebase origin/master
* fast forward
git ignore
* git ignore in global ~/.git
* cat ~/.gitconfig
* cat ~/.gitignore_global
git rebase -i
* git rebase -i
(--continue --abort --skip)
* clean up large binary commits
* git push force
git rebase vs. merge
* rebase frequently with /01 /02 branches
* squash (git rebase -i) if needed
* tests can be run locally by developer
(also possible with "git merge master")
interesting commands
* git cherry-pick
* git log --author MyName

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Git n git hub
Git n git hubGit n git hub
Git n git hub
 
Github basics
Github basicsGithub basics
Github basics
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 
Git
GitGit
Git
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
GitLab.pptx
GitLab.pptxGitLab.pptx
GitLab.pptx
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
Introduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guideIntroduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guide
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
 
Git slides
Git slidesGit slides
Git slides
 
Git
GitGit
Git
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 

Destacado

Git in gear: How to track changes, travel back in time, and code nicely with ...
Git in gear: How to track changes, travel back in time, and code nicely with ...Git in gear: How to track changes, travel back in time, and code nicely with ...
Git in gear: How to track changes, travel back in time, and code nicely with ...
fureigh
 

Destacado (17)

GIT Fundamentals
GIT FundamentalsGIT Fundamentals
GIT Fundamentals
 
Git 201: A Deeper Look at Git (Nebraska.Code 2016)
Git 201: A Deeper Look at Git (Nebraska.Code 2016)Git 201: A Deeper Look at Git (Nebraska.Code 2016)
Git 201: A Deeper Look at Git (Nebraska.Code 2016)
 
The Fundamentals of Git
The Fundamentals of GitThe Fundamentals of Git
The Fundamentals of Git
 
Git
GitGit
Git
 
#4 - Git - Stash
#4 - Git - Stash#4 - Git - Stash
#4 - Git - Stash
 
Git in gear: How to track changes, travel back in time, and code nicely with ...
Git in gear: How to track changes, travel back in time, and code nicely with ...Git in gear: How to track changes, travel back in time, and code nicely with ...
Git in gear: How to track changes, travel back in time, and code nicely with ...
 
Git-ing out of your git messes
Git-ing out of  your git messesGit-ing out of  your git messes
Git-ing out of your git messes
 
Git Hogent
Git HogentGit Hogent
Git Hogent
 
A painless git workflow
A painless git workflowA painless git workflow
A painless git workflow
 
Gibbering about git - managing your source code made easy
Gibbering about git - managing your source code made easyGibbering about git - managing your source code made easy
Gibbering about git - managing your source code made easy
 
How to store large binary files in git repositories
How to store large binary files in git repositoriesHow to store large binary files in git repositories
How to store large binary files in git repositories
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
 
What is version control software and why do you need it?
What is version control software and why do you need it?What is version control software and why do you need it?
What is version control software and why do you need it?
 
Introduction to Version Control
Introduction to Version ControlIntroduction to Version Control
Introduction to Version Control
 
Git Branching Model
Git Branching ModelGit Branching Model
Git Branching Model
 
UX, ethnography and possibilities: for Libraries, Museums and Archives
UX, ethnography and possibilities: for Libraries, Museums and ArchivesUX, ethnography and possibilities: for Libraries, Museums and Archives
UX, ethnography and possibilities: for Libraries, Museums and Archives
 
Build Features, Not Apps
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not Apps
 

Similar a Git advanced

Git tech talk
Git tech talkGit tech talk
Git tech talk
razasayed
 
GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17
siva ram
 

Similar a Git advanced (20)

Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptually
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
 
Introduction to GIT
Introduction to GITIntroduction to GIT
Introduction to GIT
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practice
 
Git: Git'ing the Basic
Git: Git'ing the BasicGit: Git'ing the Basic
Git: Git'ing the Basic
 
Git tech talk
Git tech talkGit tech talk
Git tech talk
 
Getting some Git
Getting some GitGetting some Git
Getting some Git
 
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)
 
Git kelvin
Git   kelvinGit   kelvin
Git kelvin
 
Git - Workshop Disruptiva
Git - Workshop DisruptivaGit - Workshop Disruptiva
Git - Workshop Disruptiva
 
Git: basic to advanced
Git: basic to advancedGit: basic to advanced
Git: basic to advanced
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Essential git for developers
Essential git for developersEssential git for developers
Essential git for developers
 
GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17
 
Now i git it!!!
Now i git it!!!Now i git it!!!
Now i git it!!!
 
Git: Why And How to
Git: Why And How toGit: Why And How to
Git: Why And How to
 
Git Basics 1 Carenza
Git Basics 1 CarenzaGit Basics 1 Carenza
Git Basics 1 Carenza
 
Git with the flow
Git with the flowGit with the flow
Git with the flow
 

Último

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Último (20)

Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 

Git advanced