SlideShare uma empresa Scribd logo
1 de 53
Baixar para ler offline
Ninja
master
Nicola Paolucci!
Developer Advocate / Evangelist
with!
Save your
pirateninjazombie
Nicola Paolucci
@durdn
Bio pictures: the subtle pleasure of
embarrassing yourself in front of
hundreds of people
Lock your master’s fortress
1
2
Dear Ninja apprentice, here
you’ll learn:
Powers of invisibility
Solve conflicts with power blows3
4 Cover your tracks
1.Powers of invisibility
© http://www.amigosdosbichos.org/
1.Powers of invisibility
© http://www.amigosdosbichos.org/
Hide files from
git update-index 
--assume-unchanged
very useful with git-svn
Different than .gitignore, it hides commited files
Hide files from
git update-index 
--no-assume-unchanged
Revert it with:
remember to add --no
List assumed unchanged files
git ls-files -v | grep ^h
Useful as alias (see alias list later)
Hide files in raw objects
actually writes into the object db
git hash-object -w <file>
CUSTOMARY
WARNING!
if you get in trouble, don’t
come to me :D
Treat this power with great care. !
And if you’re unsure, please refrain from experiments!
Delete branch or commits
and retrieve it later
git branch -D <branch>
git reset --hard HEAD~20
What is the reflog?
It’s a log of all the
places where your
HEAD has been
garbage collected
every
90 days
Recollect your goods
$ git reflog
!
00af1b3 HEAD@{2}: reset: moving to refexp
da5b154 HEAD@{3}: rebase finished: returning …
da5b154 HEAD@{4}: pull: checkout da5b154dfa71…
e10671f HEAD@{8}: pull origin master: checkout
Just list the HEAD moves using the reflog and
pick the one to restore
Don’t expire the reflog
[gc "refs/remotes/*"]
reflogExpire = never
reflogExpireUnreachable = never
If you hide stuff in objects not referenced, be
sure they won’t be garbage collected!
If some traitor deleted files
git log -1 -- [path]
lists where a file was deleted
git log --diff-filter=D --summary
lists all deleted files
2. Lock your master’s fortress
Always a balancing act
Security DevSpeed
Lock down your repo
# no rewriting history
denyNonFastForwards = true
!
# no deleting history
denyDeletes = true
!
# check object consistency
fsckObjects = true
Edit .git/config in the [receive] section:
Reject force push, Luke
atlss.in/update-paranoid
Git project has already an update
hook ‘update-paranoid’ that is
designed to reject history
rewriting updates
Reject force push, Luke
Impersonating Authors is easy
with .
$ git commit -m "I'm Luke"
$ git commit --author "Elvis <elvis@graceland.net>" 
-m "I'm elvis"
commit a9f0967cba236465d6cb68247..
Author: Elvis <elvis@graceland.net>
Date: Mon Apr 22 18:06:35 2013 -0500
!
I'm Elvis
!
commit d6eb7572cbb4bdd8e2aaa5c90..
Author: Luke <luke@tatooine.com>
Date: Mon Apr 22 18:04:54 2013 -0500
!
I'm Luke
Harden up by signing things
Sample gpg commands to get you started:
gpg --gen-key
Generate your GPG keys
gpg -k
List your keys
gpg -a --export <keyid>
Export your key
Store your signature in
Simple! Add a tag referencing your public key
gpg -a --export <keyid> | 
git hash-object -w --stdin
!
! Store your public key in a raw object
git tag nicks-key 187ysg
Tag the raw object with a label
git tag -s <tag_name> -m “message”
Sign a tag with your GPG key
Finally you can sign/verify tags
git tag -v <tag_name>
Verifies that the signature is valid
git cat-file -p tims-key | gpg --import
Import a GPG key from a tag
Import other public keys
Always a balancing act
Security DevSpeed
3. Solve conflicts with power blows
A word on terminology
Current checked out
branch
!
!
!--ours
What do ours and theirs mean when
solving conflicts?
Any merge/rebase
coming in
!
!
!--theirs
Basics for easy
conflict resolution
The common commands are:
$ git checkout --ours/--theirs <file>
Check back out our own/their own version of the file
$ git add <file>
Add the change to the index will resolve the conflict
Aliases for easy
conflict resolution
[alias]
ours = "!f() { 
git checkout --ours $@ && git add $@;
}; f”
!
theirs = ...
Add these to .gitconfig
Where do I get that awesome alias?
atlss.in/git-aliases
rerere resolve!
Reuse Recorded Resolution will help you
when dealing with repetitive and similar merge
conflicts.
$ git config --global rerere.enabled true
Turns it on and forget about it
Sample output rerere
$ git add hello.rb
$ git commit
Recorded resolution for 'hello.rb'.
[master 68e16e5] Merge branch 'i18n'
Auto-merging hello.rb
CONFLICT (content): Merge conflict in hello.rb
Resolved 'hello.rb' using previous resolution.
4. Cover your trackshttps://www.youtube.com/watch?v=D22gbXIx-CE
MASTER
FEATURE
What is a rebase?
It’s a way to replay commits, one by one,
on top of a branch
MASTER
FEATURE
What is a rebase?
It’s a way to replay commits, one by one,
on top of a branch
MASTER
FEATURE
What is a rebase?
It’s a way to replay commits, one by one,
on top of a branch
MASTER
FEATURE
What is a rebase?
It’s a way to replay commits, one by one,
on top of a branch
Don’t use!
Correct way to use rebase to update
a feature branch
What is a rebase?
MASTER
FEATURE
Correct way to use rebase to update
a feature branch
What is a rebase?
MASTER
FEATURE
What is a --interactive rebase?
PICK!
SQUASH
REWORD!
FIXUP
EDIT !
EXEC
It’s a way to replay commits, one by one,
deciding interactively what to do with each
--autosquash
$ git config --global rebase.autosquash true
Turns on the feature
Automatically modify the todo list of !
rebase --interactive by annotating commits
git commit -m “squash! …"
You can prepend commit messages with:
git commit -m “fixup! …"
git commit -m “reword! …"
etc…
Rebase task list will be then prepopulated
--autosquash
CUSTOMARY
WARNING!
rebase rewrites history!
Treat this power with great care. !
Only rewrite history of local branches or…
http://travisjeffery.com/b/2012/02/search-a-git-repo-
like-a-ninja/!
Bonus: greppling like a Ninja
git grep is amazing
It searches your whole project at blazing speed.
Let’s make it more awesomer!
git config --global grep.extendRegexp true
Turn on extended regular expressions
git config --global grep.lineNumber true
Include line numbers
git grep is amazing
And the final touch, pack it in an alias
git config --global alias.g 
”grep --break --heading —line-number"
!
Make it group output like Ack
Much more on git
atlassian.com/git
Nicola Paolucci
@durdn
Thank you!
Q&A
Git Repository Management for Enterprise Teams
Free Git Code Hosting for Small Teams
Free Git Desktop client for Mac or Windows
Ninja Git: Save Your Master

Mais conteúdo relacionado

Mais procurados

Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017Codemotion
 
Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010Matt Gauger
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleStein Inge Morisbak
 
Docker orchestration v4
Docker orchestration v4Docker orchestration v4
Docker orchestration v4Hojin Kim
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesLarry Cai
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleStein Inge Morisbak
 
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Puppet
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoHannes Hapke
 
Build service with_docker_in_90mins
Build service with_docker_in_90minsBuild service with_docker_in_90mins
Build service with_docker_in_90minsLarry Cai
 
Heroku 101 py con 2015 - David Gouldin
Heroku 101   py con 2015 - David GouldinHeroku 101   py con 2015 - David Gouldin
Heroku 101 py con 2015 - David GouldinHeroku
 
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境謝 宗穎
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerOrtus Solutions, Corp
 
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and KibanaPuppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibanapkill
 
Noah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku SecretsNoah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku SecretsHeroku
 
Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.Workhorse Computing
 
Zero to Continuous Delivery on Google Cloud
Zero to Continuous Delivery on Google CloudZero to Continuous Delivery on Google Cloud
Zero to Continuous Delivery on Google CloudJames Heggs
 
Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)Ontico
 

Mais procurados (20)

Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
 
Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
 
Docker orchestration v4
Docker orchestration v4Docker orchestration v4
Docker orchestration v4
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutes
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
 
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
 
Docker in practice
Docker in practiceDocker in practice
Docker in practice
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize Django
 
Docker perl build
Docker perl buildDocker perl build
Docker perl build
 
Build service with_docker_in_90mins
Build service with_docker_in_90minsBuild service with_docker_in_90mins
Build service with_docker_in_90mins
 
Heroku 101 py con 2015 - David Gouldin
Heroku 101   py con 2015 - David GouldinHeroku 101   py con 2015 - David Gouldin
Heroku 101 py con 2015 - David Gouldin
 
Git presentation
Git presentationGit presentation
Git presentation
 
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and docker
 
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and KibanaPuppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
 
Noah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku SecretsNoah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku Secrets
 
Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.
 
Zero to Continuous Delivery on Google Cloud
Zero to Continuous Delivery on Google CloudZero to Continuous Delivery on Google Cloud
Zero to Continuous Delivery on Google Cloud
 
Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)
 

Semelhante a Ninja Git: Save Your Master

Becoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola PaolucciBecoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola PaolucciAtlassian
 
Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlBecky Todd
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control SystemVictor Wong
 
Sacándole jugo a git
Sacándole jugo a gitSacándole jugo a git
Sacándole jugo a gitBerny Cantos
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With GitNick Quaranto
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it AgainGit Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it AgainLemi Orhan Ergin
 
Dive into .git
Dive into .gitDive into .git
Dive into .gitnishio
 
Free The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own DomainFree The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own DomainKen Collins
 
That's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETICThat's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETICLa FeWeb
 
Crafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyCrafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyNikhil Mungel
 
Nina Zakharenko - Introduction to Git - Start SLC 2015
Nina Zakharenko - Introduction to Git - Start SLC 2015Nina Zakharenko - Introduction to Git - Start SLC 2015
Nina Zakharenko - Introduction to Git - Start SLC 2015Nina Zakharenko
 
Git session day 2
Git session day 2Git session day 2
Git session day 2Mosaab Ehab
 
Boxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of LaptopsBoxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of LaptopsPuppet
 
Jedi Mind Tricks for Git
Jedi Mind Tricks for GitJedi Mind Tricks for Git
Jedi Mind Tricks for GitJan Krag
 

Semelhante a Ninja Git: Save Your Master (20)

Becoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola PaolucciBecoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola Paolucci
 
Git Power Routines
Git Power RoutinesGit Power Routines
Git Power Routines
 
Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version control
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Sacándole jugo a git
Sacándole jugo a gitSacándole jugo a git
Sacándole jugo a git
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it AgainGit Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it Again
 
git session --interactive
git session --interactivegit session --interactive
git session --interactive
 
Dive into .git
Dive into .gitDive into .git
Dive into .git
 
Free The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own DomainFree The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own Domain
 
Git Going With DVCS v1.5.1
Git Going With DVCS v1.5.1Git Going With DVCS v1.5.1
Git Going With DVCS v1.5.1
 
That's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETICThat's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETIC
 
Working with Git
Working with GitWorking with Git
Working with Git
 
Crafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyCrafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in Ruby
 
Git like a pro EDD18 - Full edition
Git like a pro EDD18 - Full editionGit like a pro EDD18 - Full edition
Git like a pro EDD18 - Full edition
 
Nina Zakharenko - Introduction to Git - Start SLC 2015
Nina Zakharenko - Introduction to Git - Start SLC 2015Nina Zakharenko - Introduction to Git - Start SLC 2015
Nina Zakharenko - Introduction to Git - Start SLC 2015
 
Git session day 2
Git session day 2Git session day 2
Git session day 2
 
How to use git without rage
How to use git without rageHow to use git without rage
How to use git without rage
 
Boxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of LaptopsBoxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of Laptops
 
Jedi Mind Tricks for Git
Jedi Mind Tricks for GitJedi Mind Tricks for Git
Jedi Mind Tricks for Git
 

Último

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
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 WorkerThousandEyes
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
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...Miguel Araújo
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
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 AutomationSafe Software
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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 organizationRadu Cotescu
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 

Último (20)

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
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...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 

Ninja Git: Save Your Master

  • 3. Nicola Paolucci @durdn Bio pictures: the subtle pleasure of embarrassing yourself in front of hundreds of people
  • 4. Lock your master’s fortress 1 2 Dear Ninja apprentice, here you’ll learn: Powers of invisibility Solve conflicts with power blows3 4 Cover your tracks
  • 5. 1.Powers of invisibility © http://www.amigosdosbichos.org/
  • 6. 1.Powers of invisibility © http://www.amigosdosbichos.org/
  • 7. Hide files from git update-index --assume-unchanged very useful with git-svn Different than .gitignore, it hides commited files
  • 8. Hide files from git update-index --no-assume-unchanged Revert it with: remember to add --no
  • 9. List assumed unchanged files git ls-files -v | grep ^h Useful as alias (see alias list later)
  • 10. Hide files in raw objects actually writes into the object db git hash-object -w <file>
  • 11. CUSTOMARY WARNING! if you get in trouble, don’t come to me :D Treat this power with great care. ! And if you’re unsure, please refrain from experiments!
  • 12. Delete branch or commits and retrieve it later git branch -D <branch> git reset --hard HEAD~20
  • 13. What is the reflog? It’s a log of all the places where your HEAD has been garbage collected every 90 days
  • 14. Recollect your goods $ git reflog ! 00af1b3 HEAD@{2}: reset: moving to refexp da5b154 HEAD@{3}: rebase finished: returning … da5b154 HEAD@{4}: pull: checkout da5b154dfa71… e10671f HEAD@{8}: pull origin master: checkout Just list the HEAD moves using the reflog and pick the one to restore
  • 15. Don’t expire the reflog [gc "refs/remotes/*"] reflogExpire = never reflogExpireUnreachable = never If you hide stuff in objects not referenced, be sure they won’t be garbage collected!
  • 16. If some traitor deleted files git log -1 -- [path] lists where a file was deleted git log --diff-filter=D --summary lists all deleted files
  • 17. 2. Lock your master’s fortress
  • 18. Always a balancing act Security DevSpeed
  • 19. Lock down your repo # no rewriting history denyNonFastForwards = true ! # no deleting history denyDeletes = true ! # check object consistency fsckObjects = true Edit .git/config in the [receive] section:
  • 20. Reject force push, Luke atlss.in/update-paranoid Git project has already an update hook ‘update-paranoid’ that is designed to reject history rewriting updates
  • 22. Impersonating Authors is easy with . $ git commit -m "I'm Luke" $ git commit --author "Elvis <elvis@graceland.net>" -m "I'm elvis" commit a9f0967cba236465d6cb68247.. Author: Elvis <elvis@graceland.net> Date: Mon Apr 22 18:06:35 2013 -0500 ! I'm Elvis ! commit d6eb7572cbb4bdd8e2aaa5c90.. Author: Luke <luke@tatooine.com> Date: Mon Apr 22 18:04:54 2013 -0500 ! I'm Luke
  • 23. Harden up by signing things Sample gpg commands to get you started: gpg --gen-key Generate your GPG keys gpg -k List your keys gpg -a --export <keyid> Export your key
  • 24. Store your signature in Simple! Add a tag referencing your public key gpg -a --export <keyid> | git hash-object -w --stdin ! ! Store your public key in a raw object git tag nicks-key 187ysg Tag the raw object with a label
  • 25. git tag -s <tag_name> -m “message” Sign a tag with your GPG key Finally you can sign/verify tags git tag -v <tag_name> Verifies that the signature is valid
  • 26. git cat-file -p tims-key | gpg --import Import a GPG key from a tag Import other public keys
  • 27. Always a balancing act Security DevSpeed
  • 28. 3. Solve conflicts with power blows
  • 29. A word on terminology Current checked out branch ! ! !--ours What do ours and theirs mean when solving conflicts? Any merge/rebase coming in ! ! !--theirs
  • 30. Basics for easy conflict resolution The common commands are: $ git checkout --ours/--theirs <file> Check back out our own/their own version of the file $ git add <file> Add the change to the index will resolve the conflict
  • 31. Aliases for easy conflict resolution [alias] ours = "!f() { git checkout --ours $@ && git add $@; }; f” ! theirs = ... Add these to .gitconfig
  • 32. Where do I get that awesome alias? atlss.in/git-aliases
  • 33. rerere resolve! Reuse Recorded Resolution will help you when dealing with repetitive and similar merge conflicts. $ git config --global rerere.enabled true Turns it on and forget about it
  • 34. Sample output rerere $ git add hello.rb $ git commit Recorded resolution for 'hello.rb'. [master 68e16e5] Merge branch 'i18n' Auto-merging hello.rb CONFLICT (content): Merge conflict in hello.rb Resolved 'hello.rb' using previous resolution.
  • 35. 4. Cover your trackshttps://www.youtube.com/watch?v=D22gbXIx-CE
  • 36. MASTER FEATURE What is a rebase? It’s a way to replay commits, one by one, on top of a branch
  • 37. MASTER FEATURE What is a rebase? It’s a way to replay commits, one by one, on top of a branch
  • 38. MASTER FEATURE What is a rebase? It’s a way to replay commits, one by one, on top of a branch
  • 39. MASTER FEATURE What is a rebase? It’s a way to replay commits, one by one, on top of a branch Don’t use!
  • 40. Correct way to use rebase to update a feature branch What is a rebase? MASTER FEATURE
  • 41. Correct way to use rebase to update a feature branch What is a rebase? MASTER FEATURE
  • 42. What is a --interactive rebase? PICK! SQUASH REWORD! FIXUP EDIT ! EXEC It’s a way to replay commits, one by one, deciding interactively what to do with each
  • 43. --autosquash $ git config --global rebase.autosquash true Turns on the feature Automatically modify the todo list of ! rebase --interactive by annotating commits
  • 44. git commit -m “squash! …" You can prepend commit messages with: git commit -m “fixup! …" git commit -m “reword! …" etc… Rebase task list will be then prepopulated --autosquash
  • 45. CUSTOMARY WARNING! rebase rewrites history! Treat this power with great care. ! Only rewrite history of local branches or…
  • 47. git grep is amazing It searches your whole project at blazing speed. Let’s make it more awesomer! git config --global grep.extendRegexp true Turn on extended regular expressions git config --global grep.lineNumber true Include line numbers
  • 48. git grep is amazing And the final touch, pack it in an alias git config --global alias.g ”grep --break --heading —line-number" ! Make it group output like Ack
  • 49. Much more on git atlassian.com/git
  • 51. Q&A
  • 52. Git Repository Management for Enterprise Teams Free Git Code Hosting for Small Teams Free Git Desktop client for Mac or Windows