SlideShare ist ein Scribd-Unternehmen logo
1 von 74
Downloaden Sie, um offline zu lesen
Git
      @
Git

•
Git

•
• 2005   Linus Torvalds
Git

•
• 2005 Linus Torvalds
• the stupid content tracker
Git

•
• 2005 Linus Torvalds
• the stupid content tracker
Git

•
Git

•
•
Git

•
•
•
Git
Git


•
Git


•
•
Git
• blob - 
• tree - 
• commit - 
  tree

• tag  -       blob, tree
  commit      commit
• git clone git@cat.meituan.com:www
• git clone git@cat.meituan.com:www mt
•   $git config --global user.name "john"

•   $git config --global user.email john@gmail.com
• git add template/deal/default.php
• git commit -m “update deal ui”
• git push
• git push
• git push origin master
• git status
• git status
• git status -s
• git add
• git reset HEAD
• git checkout
• git rm
• git mv
• git diff
• git diff --cached
• git diff HEAD
• git diff origin
• git log
• git log -5
• git log -p
• git log -p --author=panweizeng
• git log --since=2011-05-24
• git log --until=2011-05-25
• git log --name-only
• git log --pretty=oneline
• git log --pretty=format:%h:%s
• git log --graph
• git log --pretty=oneline
• git log --pretty=format:%h:%s
• git log --graph
• fisheye
  http://www.atlassian.com/software/fisheye/
• git pull
• git pull
• git fetch && git merge origin/master
• git help command
  git help commit
  git help push
  git help log
• Git
• git branch hotfix
• git checkout -b hotfix
• git checkout -b hotfix master
• git checkout hotfix
• git checkout master
• git merge hotfix
• git merge origin/master
• git merge --squash
• git branch -v
• git branch -d hotfix
• git branch -D hotfix
• git branch --merged
• git branch --no-merged
• git push origin abc #
• git push origin :abc #
• git branch -a #
• git push origin panweizeng/abc
• git push origin :panweizeng/abc
•
•
•
master
master


develop
master


develop


mirror
master


develop


mirror
master


develop


mirror
master


develop


mirror
master
•
•   git config --global color.ui auto

•   git config --global alias.st status

•   git config core.filemode false

•   git config -l

•   /etc/gitconfig
    ~/.gitconfig
    .git/config
HASH

•   git show c2bd66ee2f5ebef7dac171fca57875bd99f47318

•   git show c2bd66ee2f5ebef7

•   git show c2bd66ee

•   git show c2bd
• git stash
• git stash apply
• git stash list
• git stash branch abc
• git grep keyword
• git grep keyword -i -A10 -B10
• git blame filename
• git commit -m “new mobile”
• git add forgotten_file
• git commit --amend
• git rebase -i 32cb53^
• git commit --amend
• git rebase --continue
• git rebase -i 32cb53^
• git commit --amend
• git rebase --continue

                     push
diff

• git diff > ~/diff #       diff

• git apply ~/diff # diff
• patch -p1 < ~/diff #             git
[panweizeng@dev:mt(master)]$ git checkout develop
Switched to branch 'develop'
[panweizeng@dev:mt(develop)]$ git checkout mis
Switched to branch 'mis'
[panweizeng@dev:mt(mis)]$
~/.bashrc
function parse_git_branch {
    git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e
's/* (.*)/(1)/' -e 's/((/(/' -e 's/))/)/'
}

function proml {
    local GREEN="[033[0;32m]"
    local COLOR_END="033[0m"
    PS1="[u@h:W$GREEN$(parse_git_branch)$COLOR_END]$ "
}
proml
$cd ~/bin
$curl -O https://github.com/git/git/raw/master/
contrib/completion/git-completion.bash
$curl -O https://github.com/bobthecow/git-flow-
completion/raw/master/git-flow-completion.bash
   ~/.bashrc
source ~/bin/git-completion.bash
source ~/bin/git-flow-completion.bash
$cd ~/bin
$curl -O https://github.com/git/git/raw/master/
contrib/completion/git-completion.bash
$curl -O https://github.com/bobthecow/git-flow-
completion/raw/master/git-flow-completion.bash
   ~/.bashrc
source ~/bin/git-completion.bash
source ~/bin/git-flow-completion.bash

         /etc/bash_completion.d/    /etc/profile
for i in /etc/bash_completion.d/* ; do
     if [ -r "$i" ]; then
         . $i
     fi
done
•
•
•
•
•
•   git
The End


• http://progit.org/book/zh
The End


• http://progit.org/book/zh

Weitere ähnliche Inhalte

Was ist angesagt?

Cool Git Tricks (That I Learn When Things Go Badly) [1/2]
Cool Git Tricks (That I Learn When Things Go Badly) [1/2]Cool Git Tricks (That I Learn When Things Go Badly) [1/2]
Cool Git Tricks (That I Learn When Things Go Badly) [1/2]Carina C. Zona
 
Git Basics at Rails Underground
Git Basics at Rails UndergroundGit Basics at Rails Underground
Git Basics at Rails UndergroundAriejan de Vroom
 
Contributing to Core Python
Contributing to Core PythonContributing to Core Python
Contributing to Core PythonAbhijeet Kasurde
 
The Fundamentals of Git
The Fundamentals of GitThe Fundamentals of Git
The Fundamentals of GitDivineOmega
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control SystemVictor Wong
 
Zero to Hero - Ansible 101
Zero to Hero - Ansible 101Zero to Hero - Ansible 101
Zero to Hero - Ansible 101Abhijeet Kasurde
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in UnityRifauddin Tsalitsy
 
Lagos GitHub Meetup - What is Git?
Lagos GitHub Meetup - What is Git?Lagos GitHub Meetup - What is Git?
Lagos GitHub Meetup - What is Git?Celestine Omin
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git TutorialSage Sharp
 

Was ist angesagt? (20)

Git advanced
Git advancedGit advanced
Git advanced
 
Cool Git Tricks (That I Learn When Things Go Badly) [1/2]
Cool Git Tricks (That I Learn When Things Go Badly) [1/2]Cool Git Tricks (That I Learn When Things Go Badly) [1/2]
Cool Git Tricks (That I Learn When Things Go Badly) [1/2]
 
Don't fear the rebase
Don't fear the rebaseDon't fear the rebase
Don't fear the rebase
 
Git Basics at Rails Underground
Git Basics at Rails UndergroundGit Basics at Rails Underground
Git Basics at Rails Underground
 
Git essentials
Git essentialsGit essentials
Git essentials
 
Contributing to Core Python
Contributing to Core PythonContributing to Core Python
Contributing to Core Python
 
The Fundamentals of Git
The Fundamentals of GitThe Fundamentals of Git
The Fundamentals of Git
 
Github integration-kostyasha
Github integration-kostyashaGithub integration-kostyasha
Github integration-kostyasha
 
Git & GitHub WorkShop
Git & GitHub WorkShopGit & GitHub WorkShop
Git & GitHub WorkShop
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Git walkthrough
Git walkthroughGit walkthrough
Git walkthrough
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Developing ansible module
Developing ansible moduleDeveloping ansible module
Developing ansible module
 
Loading...git
Loading...gitLoading...git
Loading...git
 
Zero to Hero - Ansible 101
Zero to Hero - Ansible 101Zero to Hero - Ansible 101
Zero to Hero - Ansible 101
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
 
Presentacion git
Presentacion gitPresentacion git
Presentacion git
 
Lagos GitHub Meetup - What is Git?
Lagos GitHub Meetup - What is Git?Lagos GitHub Meetup - What is Git?
Lagos GitHub Meetup - What is Git?
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 

Ähnlich wie Git 基础

Git isthenewsexy
Git isthenewsexyGit isthenewsexy
Git isthenewsexyAilsa126
 
Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Bosstmacwilliam
 
Git study notes
Git study notesGit study notes
Git study notesAngus Li
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.comdropsolid
 
maksym vlasov - culture of git as roots of your ci
maksym vlasov - culture of git as roots of your cimaksym vlasov - culture of git as roots of your ci
maksym vlasov - culture of git as roots of your ciDariia Seimova
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notesglen_a_smith
 
僕とhuskyとrm -rf .git/
僕とhuskyとrm -rf .git/僕とhuskyとrm -rf .git/
僕とhuskyとrm -rf .git/pmw1415
 
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...WSO2
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An IntroductionBehzad Altaf
 
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
 
Git简介
Git简介Git简介
Git简介clvrobj
 
Learning Basic GIT Cmd
Learning Basic GIT CmdLearning Basic GIT Cmd
Learning Basic GIT Cmdsrinathcox
 
An introduction to Git
An introduction to GitAn introduction to Git
An introduction to GitMuhil Vannan
 
COSCUP 開源工作坊:Git workflows
COSCUP 開源工作坊:Git workflowsCOSCUP 開源工作坊:Git workflows
COSCUP 開源工作坊:Git workflowsCarl Su
 

Ähnlich wie Git 基础 (20)

Git isthenewsexy
Git isthenewsexyGit isthenewsexy
Git isthenewsexy
 
Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Boss
 
Git study notes
Git study notesGit study notes
Git study notes
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
 
maksym vlasov - culture of git as roots of your ci
maksym vlasov - culture of git as roots of your cimaksym vlasov - culture of git as roots of your ci
maksym vlasov - culture of git as roots of your ci
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
僕とhuskyとrm -rf .git/
僕とhuskyとrm -rf .git/僕とhuskyとrm -rf .git/
僕とhuskyとrm -rf .git/
 
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
 
Git
GitGit
Git
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Git 101 for_tarad_dev
Git 101 for_tarad_devGit 101 for_tarad_dev
Git 101 for_tarad_dev
 
Basic git
Basic gitBasic git
Basic git
 
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简介Git简介
Git简介
 
The git
The gitThe git
The git
 
Learning Basic GIT Cmd
Learning Basic GIT CmdLearning Basic GIT Cmd
Learning Basic GIT Cmd
 
An introduction to Git
An introduction to GitAn introduction to Git
An introduction to Git
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshell
 
COSCUP 開源工作坊:Git workflows
COSCUP 開源工作坊:Git workflowsCOSCUP 開源工作坊:Git workflows
COSCUP 開源工作坊:Git workflows
 
Git
Git Git
Git
 

Kürzlich hochgeladen

Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 

Kürzlich hochgeladen (20)

Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 

Git 基础