SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Git From noob to pro
Version Control Fast Distributed What is Git?
“Git made me a more productive coder because it showed me how much progress I had made” – Thomas “Synk” Kelley “I use Git because the commands are really easy to use. I use Git because if I want to set up a Git server on the Internet it does not require any extra processes on my server, all I need is an SSH connection” – Chris “Panda” Nord Why Git?
Modified – I modified a file Staged – Git has taken a snapshot of my modification Commited – Git has permanently recorded my modifications from the stage The three file stages in Git
The three file stages in Git
git init git add files git commit –m ‘my commit message’ A new Git repository
..What just happened?
..What just happened?
git clone location git clone myserver.com:/path/to/repo/.git gitclone git://github.com/username/project.git git pull git push An existing repository
gitdiff git revert git checkout git log git blame git tag Useful commands
git branch new_branch git checkout new_branch Branching
Branching
Merging
Merging
Implementation detail
Implementation detail
Implementation detail
Implementation detail
Implementation detail
Implementation detail
Implementation detail
Interactive staging Stashing Bisect Other notables!
Questions?
Images taken from progit.org and marklodato.github.com/visual-git-guide Credits

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

GitHub Talk - Cody Carnachan
GitHub Talk - Cody CarnachanGitHub Talk - Cody Carnachan
GitHub Talk - Cody Carnachan
 
Git basics
Git basicsGit basics
Git basics
 
HacktoberFest-Git&GitHub
HacktoberFest-Git&GitHubHacktoberFest-Git&GitHub
HacktoberFest-Git&GitHub
 
Git basics
Git basicsGit basics
Git basics
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
 
Github
GithubGithub
Github
 
Stable master workflow with Gerrit Code Review
Stable master workflow with Gerrit Code ReviewStable master workflow with Gerrit Code Review
Stable master workflow with Gerrit Code Review
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
 
Getting Started with Git and GitHub
Getting Started with Git and GitHubGetting Started with Git and GitHub
Getting Started with Git and GitHub
 
GitHub Actions demo with mabl
GitHub Actions demo with mablGitHub Actions demo with mabl
GitHub Actions demo with mabl
 
Git & Github
Git & GithubGit & Github
Git & Github
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Git basics
Git basicsGit basics
Git basics
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git Primer
Git PrimerGit Primer
Git Primer
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
 
Introduction to GitHub
Introduction to GitHubIntroduction to GitHub
Introduction to GitHub
 

Ähnlich wie Git

Source Code Management with Git
Source Code Management with GitSource Code Management with Git
Source Code Management with Git
Things Lab
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
Terry Wang
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
Terry Wang
 

Ähnlich wie Git (20)

Git presentation
Git presentationGit presentation
Git presentation
 
GIT By Sivakrishna
GIT By SivakrishnaGIT By Sivakrishna
GIT By Sivakrishna
 
Web Programming - Git basics
Web Programming - Git basicsWeb Programming - Git basics
Web Programming - Git basics
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Source Code Management with Git
Source Code Management with GitSource Code Management with Git
Source Code Management with 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)
 
Lagos GitHub Meetup - What is Git?
Lagos GitHub Meetup - What is Git?Lagos GitHub Meetup - What is Git?
Lagos GitHub Meetup - What is Git?
 
git-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdfgit-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdf
 
Introduction to Git.pptx
Introduction to Git.pptxIntroduction to Git.pptx
Introduction to Git.pptx
 
Git with the flow
Git with the flowGit with the flow
Git with the flow
 
Git learn from scratch
Git learn from scratchGit learn from scratch
Git learn from scratch
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
Grokking opensource with github
Grokking opensource with githubGrokking opensource with github
Grokking opensource with github
 
Git basic and workflow
Git basic and workflowGit basic and workflow
Git basic and workflow
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHub
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 
Git
GitGit
Git
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptx
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
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
 

Kürzlich hochgeladen (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
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
 
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
 
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
 
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
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
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...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
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
 

Git

Hinweis der Redaktion

  1. Version Control – Who has ever made a backup of some source code before making a major change to it? That’s a basic form of version control. You also see version control on Wikipedia, with it’s storage of change history.Modern version control software usually includes the following: * Manages changes * Allows multiple developers to work together on the same project, even the same file * Merge those changes * Track who changed what and when * Maintain multiple lines of development at a timeFast – Git was built by Linus Torvalds (Chief architect of the Linux kernel). Git was built from the ground up with speed in mind, and takes advantage of an intimate knowledge of the Linux kernel to do what it needs to do quickly. This means that Windows performance and support wasn’t very good before Git started gaining a lot popularity.Distributed – Instead of just having the version history on your machine or a server machine, the version history is kept on ALL clients. Calling one particular machine with the history the server is artificial, since it knows just as much as any of the clients do, but it’s often convenient to have your development efforts focus around one central machine.This distribution also makes Git that much faster. You don’t have to use any network operations to request project history or to look at differences between files, because you already have all that information locally. You’ll still be able to make changes when you don’t have access to the Internet and to record those changes in your local database. When you have Internet again, you’ll sync those changes with the other developers.
  2. Now I’ll go over some basic terminology in Git that is very important to understand if you want to use Git.Modified – Literally, you have modified a file, but you haven’t interacted with Git on any way with your modification yet.Staged – You inform Git to pay attention to your modification AS IT CURRENTLY IS (Git makes a copy). This is also sometimes referred to as the index.Committed – Git has recorded your modification for the benefit of future generations.
  3. Git add is also called “staging the files”Git reset copies files from the latest commit into the stage. This is an “unstage” operation.Git checkout copies files from the stage to your working directory. Use this to throw away modifications to files.
  4. All commands in git are “git”, space, followed by a verb.Git init creates a new git repository in the current directory. Nothing is tracked yet.Using .gitignore, git status, and git reset – filesUse git mv to move files, same as mv, git add, git rm. Git is very intelligent about file movement.
  5. Git clone clones the ENTIRE repository. That is, a snapshot of each file at each revision. This means that all operations will be lightening fast since they’re all local, but it does have the downside that git clone might take a while with larger repositories.Git pull “pulls” any changes made to the remote repository (the one at the location specified in git clone) into your local repository.Git push pushes any changes committed to the local repository to the remote repository.
  6. Git log –pretty = one of oneline, short, medium, full, fuller, email, raw
  7. What is a branching? It means you diverge from the main line of development and continue to do work without making any changes to the main line. For example, branches are commonly made for maintenance development from previous releases, so the main line can be devoted to current work with the latest major revisions. Or, you might make a branch for working on a particularly large bug fix. Or, simply an experimental branch to see if a series of changes can improve the software any. If they do, they’re easily merged back in, if it doesn’t, no harm done to the main line.Branching is often hailed as one of Git’s strongest points. It’s so simple, convenient, and elegant and fast to create branches and merge them in again that it’s often referred to as Git’s killer feature.
  8. Git does a three way merge here.
  9. This is the first commit in a repository, a commit that contains three files. The blobs represent each file, the tree object is the root folder which contains pointers to each file in the folder, and the commit object contains a pointer to the root folder.Git stores file snapshots at each revision, not deltas (diffs). File that change have an entirely new object devoted to the new file. If a file stays the same, the new tree object for the commit points to the same blob.
  10. Here is the same repository after two more commits. Each of the blue objects is the new tree object representing the root directory of the commit.
  11. Here’s the same repository, but showing the masterbranchSo what happens when we create another branch for the repository?...
  12. This is all well and good, but how does Git know what branch or commit we’re currently working with in the working directory? …
  13. It turns out that Git has a special pointer to what we’re currently working withSo what happens if we switch to the testing branch and make a commit?
  14. So what happens if we switch back to the master branch, change some files, and commit?
  15. Bisect lets you perform a binary search across commits, searching for the origin of a particular bug