SlideShare uma empresa Scribd logo
1 de 56
Baixar para ler offline
jugo a GIT
Sacándole
ocalipsis
ervivencia para el ap
Manual de sup

// Porque con zombies todo suena más molón

zombie
uién soy yo?
¿Q
Berny Cantos
Developeando since 1994
Usando GIT desde 2011
Currando en Ofertix™ desde 2013

@xPheRe
¿Qué es GIT?
es un DVCS
GIT
●
●
●
●

Distributed
Version
Control
System
S? (sin la D)
¿Qué es un VC
● Gestión de cambios
¿Qué?
¿Cuándo?
¿Cómo?
¿Por qué?
S? (sin la D)
¿Qué es un VC
● Gestión de cambios

¿Quién?
S? (sin la D)
¿Qué es un VC
● Máquina del tiempo
S? (sin la D)
¿Qué es un VC
● DISCLAIMER:
un VCS no es esto
S? (sin la D)
¿Qué es un VC
● Colaboración
¿Y la D?
● Cambios distribuidos
● Trabajar en repositorio local
● Compartir en repositorio remoto
funciona GIT?
¿Cómo
e a tus aliados
Conoc
●
●
●
●

Working Tree / Workspace
Index / Staging area
Local repository
Remote repository
s de un fichero
Index: Estado

rm

Indexed

Modified

Untracked

Unmodified

add

add (--patch)

commit
push

commit -a

Remote

commit

Local

add

Index

Working Tree

dos escritura
Coman
checkout

reset --hard

fetch

Remote

reset

Local

Index

Working Tree

mandos lectura
Co

pull
mo funciona?
¿Có
*
Blob

*

Tree

Commit

Tag

Ref
Referencias
● Punteros a un commit
● Ligeros de gestionar
● Diversos tipos
○
○
○
○

tag
branch
remote
symbolic
Workflow
● Ventaja
○ git no define un workflow

● Inconveniente
○ git no define un workflow
adir un título
z ando par s añ
mclick s báaicos
Ho
Ca
Inicialización
> git init "."
Initialized empty Git repository in /home/jrrt/docs/.git
Configuración
> git config user.email "root@middle-earth.com"
> git config user.name "John Ronald Reuel Tolkien" --global
> git config core.editor "vi" --system
stá pasando?
¿Qué e
> git status
#
#
#
#
#
#
#
#
#

On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
the-hobbit.txt
nothing added to commit but untracked files present
use "git add" to track
stá pasando?
¿Qué e
> git status --short --branch --untracked-files=normal
## Initial commit on 'master' branch
?? the-hobbit.txt
primer commit
Mi
> git add -A
> git commit

> git commit -a -m "Not a dwarf's story" --edit
[master (root-commit) 7b092a2] Not a dwarf's story
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 the-hobbit.txt

HEAD
master
 7b09 
de un commit
Anatomía
> git log -1
commit 7b092a2be4f147aa7878cb37e1228a5c38cd3949
Author: John Ronald Reuel Tolkien <root@middle-earth.com>
Date:
Wed Aug 14 13:20:19 1922 +0100
Not a dwarf's story
I put some trolls too. And elves with pointy ears.
Not sure about the whole thing with the ring, though.

HEAD
master
 7b09 
Remotes
> git remote add "endor" "https://github.com/jrrt/hobbit.git"
> git push -u "endor" master:heru

HEAD
master

endor/heru
 7b09 
Branches
> git branch "dragon" HEAD
> git checkout "dragon"

> git checkout -b "dragon"

HEAD
dragon
master
 7b09 
Indexando
> git add "the-hobbit.txt"
> git commit -m "Enter Pryftan, the motherfu**ing dragon"

HEAD
dragon
master
 7b09 

 69d2 
¿Corregimos?
> sed -i "s/Pryftan/Smaug/g" "the-hobbit.txt"
> git add "the-hobbit.txt"
> git commit --amend -m "Enter Smaug, the motherfu**ing dragon"

HEAD
dragon
master
 7b09 

 69d2 
 1c6a 
Diferencias
> git diff 7b09
diff --git i/the-hobbit.txt w/the-hobbit.txt
--- i/the-hobbit.txt
+++ w/the-hobbit.txt
@@ -1 +1 @@
-Pryftan really did laugh, a devastating sound which shook Bilbo to the floor
+Smaug really did laugh, a devastating sound which shook Bilbo to the floor

HEAD
dragon
master
 7b09 

 69d2 
 1c6a 
Pull
> git checkout master
> git pull
From https://github.com/jrrt/hobbit.git
7b092a2..62e3342 heru
-> endor/heru
Updating 7b092a2..62e3342
Fast-forward

dragon

 1c6a 

HEAD
master

 5b3f 

endor/heru
 7b09 

 a9af 

 62e3 
Merge
> git merge --no-ff "dragon"

dragon

 1c6a 

 7b09 

HEAD
master

 5b3f 

 692e 

 a9af 

 62e3 
GitHub
GitHub
GitHub es…
●
●
●
●

“Build software better, together”
Servicio de gestión avanzada GIT
Mejoras en la colaboración
Social
Herramientas
●
●
●
●
●

Pull Request
Comentarios
Issues
Labels
Wiki
own à la GitHub
Markd
●
●
●
●

Filtro de texto plano a HTML
Mejoras GitHub
Específicas GitHub
Emojis!
Shortcuts
[?]
[s]
[j]
[g]
[t]
[w]

es tu tecla amiga
/ [/] busca en tus repos/repo actual
/ [k] selección arriba/abajo
+ [c] / [i] / [p] ir al código/issues/PRs
buscar por nombre de fichero
cambiar rama
GIT avanzado
os de comando
Tip
● Porcelain
○ user-friendly
○ add, commit, pull, …

● Plumbing
○ script-friendly
○ cat-file, update-ref, merge-base, …
Revisiones
>
>
>
>
>
>

git
git
git
git
git
git

rev-parse
rev-parse
rev-parse
rev-parse
rev-parse
rev-parse

refname~{num}
refname^{num}
refname@{time}
refname@{num}
refname@{u}
@{-num}

// go up num levels
// choose from multiple parents
// where the ref pointed time ago
// where the ref pointed num entries ago
// refname's upstream
// <n>th branch checked out before current
Revisiones
>
>
>
>
>
>

git
git
git
git
git
git

rev-parse
rev-parse
rev-parse
rev-parse
rev-parse
rev-parse

HEAD^
master^2
master^^
dragon~2
dragon@{1}
master@{u}

62e3
5b3f
a9af
7b09
1c6a
62e3
dragon

 1c6a 

HEAD
master

 5b3f 

 692e 

endor/heru
 7b09 

 a9af 

 62e3 
de encuentro
Punto
> git merge-base master dragon
7b092a2be4f147aa7878cb37e1228a5c38cd3949

dragon

 1c6a 

 7b09 

HEAD
master

 5b3f 

 a9af 

 62e3 
tando commits
Lis
> git log --graph --decorate --pretty=oneline
* b964a8d (dragon) Merged Edith fixes
|
| * 62e3342 (endor/heru) Rewording for better readability
| * a9af710 Fixed typos in first draft
* | 5b3ffe4 Add more dwarfs
* | 1c6ad34 Enter Smaug, the motherfu**ing dragon
|/
* 7b092a2 Not a dwarf's story
tando commits
Lis
> git log -S "Gandalf" --pretty="%h %s by %aN %ar"
62e3342 Rewording for better readability by JRRTolkien 2 hours ago
7b092a2 Not a dwarf's story by JRRTolkien 3 days ago

> git log --oneline -- LICENSE
7b092a2 Not a dwarf's story
Moviéndose
> git reset --soft "62e3"
> git reset --hard "62e3"
> git reset "62e3"

HEAD
master

dragon

 1c6a 

 7b09 

HEAD
master

 5b3f 

 a9af 

 62e3 

 692e 
ando la historia
Cambi
> git rebase "7b09" "dragon" --onto "master"
dragon

 1c6a 

HEAD
master

 5b3f 

 692e 

 7b09 

 a9af 

HEAD
dragon

master

 7b09 

 a9af 

 62e3 

 62e3 

 12b3 

 48c2 
quito a poco
Po
> git checkout master
> git cherry-pick 1c6a 5b3f
dragon

 1c6a 

HEAD
master

 5b3f 

 7b09 

 a9af 

 62e3 

HEAD
master

 12b3 

 48c2 

HEAD
master
dragon
 7b09 

 a9af 

 62e3 

 12b3 

 48c2 
Marcha atrás
> git checkout -f HEAD
> git reset --hard
> git clean -df
> git revert "a9af"
> git rebase --interactive HEAD "a9af"~
interactivo
Rebase
> git rebase --interactive 7b09 dragon
pick 5b3f Bilbo is chased by the dragon
pick 1c6a Dragon description
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
El alijo…
> git stash -u -k
> git lol stash@{0}
*-. f571325 WIP on master:
| 
| | * b4bea53 untracked files on master:
| * a9af710 index on master:
|/
* 012f62b (master) Enter Smaug, the motherfu**ing dragon
…

> git stash apply
> git stash drop
> git stash pop
Reflog
> git reflog dragon
ab4a dragon@{0}: rebase finished: refs/heads/dragon onto ab4a
5b3f dragon@{1}: reset: moving to HEAD~
b964 dragon@{2}: pull endor heru: Merge made by the 'recursive' strategy.
Alias
> git config alias.lol "log --graph --decorate --oneline" --global
> git lol
* b964a8d (dragon)
|
| * 62e3342 (endor/heru) Rewording for better readability
| * a9af710 Fixed typos in first draft
* | 5b3ffe4 Add more dwarfs
* | 1c6ad34 Enter Smaug, the motherfu**ing dragon
|/
* 7b092a2 Not a dwarf's story
Alias
> git config alias.replay '!f() {
git rebase "$(git merge-base HEAD "$1")" "$1" --onto HEAD
}; f'
> git replay dragon
s de interés
Enlace
●
●
●
●

official website
visual git reference
git workflows
xphere@github/system/git
THE END
jugo a GIT
Sacándole
ocalipsis
ervivencia para el ap
Manual de sup

// Porque con zombies todo suena más molón
// TO DO: Añadir zombies

zombie

Mais conteúdo relacionado

Mais procurados

The Next Linux Superpower: eBPF Primer
The Next Linux Superpower: eBPF PrimerThe Next Linux Superpower: eBPF Primer
The Next Linux Superpower: eBPF Primer
Sasha Goldshtein
 
slides.pdf
slides.pdfslides.pdf
slides.pdf
vidsvagi
 
Eat my data
Eat my dataEat my data
Eat my data
Peng Zuo
 

Mais procurados (20)

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 of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commandsGit: An introduction of plumbing and porcelain commands
Git: An introduction of plumbing and porcelain commands
 
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
 
Git Basic
Git BasicGit Basic
Git Basic
 
GIT_In_90_Minutes
GIT_In_90_MinutesGIT_In_90_Minutes
GIT_In_90_Minutes
 
Keep your GIT history clean
Keep your GIT history cleanKeep your GIT history clean
Keep your GIT history clean
 
Linux Kernel 개발참여방법과 문화 (Contribution)
Linux Kernel 개발참여방법과 문화 (Contribution)Linux Kernel 개발참여방법과 문화 (Contribution)
Linux Kernel 개발참여방법과 문화 (Contribution)
 
Qt native built for raspberry zero
Qt native built for  raspberry zeroQt native built for  raspberry zero
Qt native built for raspberry zero
 
Kernel Recipes 2017 - Modern Key Management with GPG - Werner Koch
Kernel Recipes 2017 - Modern Key Management with GPG - Werner KochKernel Recipes 2017 - Modern Key Management with GPG - Werner Koch
Kernel Recipes 2017 - Modern Key Management with GPG - Werner Koch
 
Now i git it!!!
Now i git it!!!Now i git it!!!
Now i git it!!!
 
Basic git
Basic gitBasic git
Basic git
 
The Next Linux Superpower: eBPF Primer
The Next Linux Superpower: eBPF PrimerThe Next Linux Superpower: eBPF Primer
The Next Linux Superpower: eBPF Primer
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
slides.pdf
slides.pdfslides.pdf
slides.pdf
 
Streams for the Web
Streams for the WebStreams for the Web
Streams for the Web
 
BPF Internals (eBPF)
BPF Internals (eBPF)BPF Internals (eBPF)
BPF Internals (eBPF)
 
Git basics
Git basicsGit basics
Git basics
 
Linux Commands
Linux CommandsLinux Commands
Linux Commands
 
Git Without Puns
Git Without PunsGit Without Puns
Git Without Puns
 
Eat my data
Eat my dataEat my data
Eat my data
 

Destaque (6)

Bringing the Open Web & APIs to 
mobile devices with Firefox OS - SpainJS
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - SpainJSBringing the Open Web & APIs to 
mobile devices with Firefox OS - SpainJS
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - SpainJS
 
Monitorización DeSymfony
Monitorización DeSymfonyMonitorización DeSymfony
Monitorización DeSymfony
 
Desglosando el componente de seguridad
Desglosando el componente de seguridadDesglosando el componente de seguridad
Desglosando el componente de seguridad
 
How to write a successful proposal for actfl
How to write a successful proposal for actflHow to write a successful proposal for actfl
How to write a successful proposal for actfl
 
Caja "Ka-ha" Introduction
Caja "Ka-ha" IntroductionCaja "Ka-ha" Introduction
Caja "Ka-ha" Introduction
 
ESCMAScript 6: Get Ready For The Future. Now
ESCMAScript 6: Get Ready For The Future. NowESCMAScript 6: Get Ready For The Future. Now
ESCMAScript 6: Get Ready For The Future. Now
 

Semelhante a Sacándole jugo a git

Pragmatic Guide to Git
Pragmatic Guide to GitPragmatic Guide to Git
Pragmatic Guide to Git
ConFoo
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
Victor Wong
 
Git Power Routines
Git Power RoutinesGit Power Routines
Git Power Routines
Nicola Paolucci
 

Semelhante a Sacándole jugo a git (20)

Loading...git
Loading...gitLoading...git
Loading...git
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
git session --interactive
git session --interactivegit session --interactive
git session --interactive
 
GIT Basics
GIT BasicsGIT Basics
GIT Basics
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Introduction to Git (Greg Lonnon)
Introduction to Git (Greg Lonnon)Introduction to Git (Greg Lonnon)
Introduction to Git (Greg Lonnon)
 
How to use git without rage
How to use git without rageHow to use git without rage
How to use git without rage
 
Working with Git
Working with GitWorking with Git
Working with Git
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
 
Git presentation bixlabs
Git presentation bixlabsGit presentation bixlabs
Git presentation bixlabs
 
Jedi Mind Tricks for Git
Jedi Mind Tricks for GitJedi Mind Tricks for Git
Jedi Mind Tricks for Git
 
Honestly Git Playground 20190221
Honestly Git Playground 20190221Honestly Git Playground 20190221
Honestly Git Playground 20190221
 
Jedi Mind Tricks in Git
Jedi Mind Tricks in GitJedi Mind Tricks in Git
Jedi Mind Tricks in Git
 
Git presentation
Git presentationGit presentation
Git presentation
 
Pragmatic Guide to Git
Pragmatic Guide to GitPragmatic Guide to Git
Pragmatic Guide to Git
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Trace kernel code tips
Trace kernel code tipsTrace kernel code tips
Trace kernel code tips
 
slides.pdf
slides.pdfslides.pdf
slides.pdf
 
Git Power Routines
Git Power RoutinesGit Power Routines
Git Power Routines
 
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 

Sacándole jugo a git