SlideShare a Scribd company logo
1 of 30
git
davidx <mykingheaven@gmail.com>
git

• SCM
•

•

•
svn       较
•GIT         •SVN
•            •
•            •
•            •
• 长          •   长
•处           •处      较
GIT
仓库

davidx-laptop:Projects davidx$ mkdir test
davidx-laptop:Projects davidx$ cd test
davidx-laptop:test davidx$ git init
Initialized empty Git repository in /Users/davidx/Projects/test/.git/
davidx-laptop:test davidx$
进           仓库
davidx-laptop:test davidx$ touch README
davidx-laptop:test davidx$ git add README
davidx-laptop:test davidx$ git add test2/
davidx-laptop:test davidx$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
#
 new file: README
#
 new file: test2/file1
#
 new file: test2/file2
#
 new file: test2/file3
davidx-laptop:test davidx$ git commit -m "init commit"
[master (root-commit) e55ac19] init commit
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 README
 create mode 100644 test2/file1
 create mode 100644 test2/file2
 create mode 100644 test2/file3
历

davidx-laptop:test davidx$ git log
commit e55ac19e882cc3c931f2d844df14578c8109af8e
Author: davidx <mykingheaven@gmail.com>
Date: Tue Sep 21 15:35:59 2010 +0800

  init commit
删

davidx-laptop:test davidx$ git rm test2/file1
rm 'test2/file1'
davidx-laptop:test davidx$ git rm test2/file2 test2/file3
rm 'test2/file2'
rm 'test2/file3'
davidx-laptop:test davidx$ git commit -m "delete some files"
[master 458781d] delete some files
 0 files changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 test2/file1
 delete mode 100644 test2/file2
 delete mode 100644 test2/file3
销


davidx-laptop:test davidx$ git checkout README
• git reset SHA1

• git reset HEAD~1
clone




• git clone <git_url> <local_directory>
davidx-laptop:test davidx$ git
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
      [-p|--paginate|--no-pager] [--no-replace-objects]
      [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
      [--help] COMMAND [ARGS]

The most commonly used git commands are:
 add     Add file contents to the index
 bisect Find by binary search the change that introduced a bug
 branch List, create, or delete branches
 checkout Checkout a branch or paths to the working tree
 clone    Clone a repository into a new directory
 commit Record changes to the repository
 diff   Show changes between commits, commit and working tree, etc
 fetch   Download objects and refs from another repository
 grep    Print lines matching a pattern
 init   Create an empty git repository or reinitialize an existing one
 log    Show commit logs
 merge     Join two or more development histories together
 mv      Move or rename a file, a directory, or a symlink
 pull    Fetch from and merge with another repository or a local branch
 push     Update remote refs along with associated objects
 rebase Forward-port local commits to the updated upstream head
 reset   Reset current HEAD to the specified state
 rm      Remove files from the working tree and from the index
 show     Show various types of objects
 status Show the working tree status
 tag    Create, list, delete or verify a tag object signed with GPG

See 'git help COMMAND' for more information on a specific command.
git 级
• push
• pull
branch

• GIT

•            应该

• 结      ,   应该merge
branch
•           : git branch <branch name>

•     换          : git checkout <branch
    name>
•           --              换    该        :
    git checkout -b <branch name>
branch

davidx-laptop:test davidx$ git branch new
davidx-laptop:test davidx$ git checkout new
Switched to branch 'new'
davidx-laptop:test davidx$ git branch
 master
* new
davidx-laptop:test davidx$ git checkout -b new2
Switched to a new branch 'new2'
davidx-laptop:test davidx$ git branch
 master
 new
* new2
branch


•             : git branch

• 删       : git branch -d <branch name>

•               master

•     删
branch



•           : git merge <source branch
    name>
•    标      为
branch
davidx-laptop:test davidx$ git checkout new2
Switched to branch 'new2'
davidx-laptop:test davidx$ touch new_file_2
davidx-laptop:test davidx$ git add new_file_2
davidx-laptop:test davidx$ git commit -a
[new2 e69c6a9] new file: new_file_2
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 new_file_2
davidx-laptop:test davidx$ git checkout master
Switched to branch 'master'
davidx-laptop:test davidx$ git merge new2
Updating cb88fd0..e69c6a9
Fast-forward
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 new_file_2
tag

•    态   标

•      branch

•   为version发
tag


davidx-laptop:test davidx$ git tag
davidx-laptop:test davidx$ git tag 1.0
davidx-laptop:test davidx$ git tag
1.0
问题
问题

Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

  git config --global user.name "Your Name"
  git config --global user.email you@example.com

If the identity used for this commit is wrong, you can fix it with:

  git commit --amend --author='Your Name <you@example.com>'
GITCONFIG


•    ~/.gitconfig

•    [user] section

• name=XXXX
• email=XXXX@YYY.ZZZ
GITCONFIG

[user]

 name = davidx

 email = mykingheaven@gmail.com
[core]

 editor = vim
.gitignore


•     录    .gitignore

• *.XXX
• XXX/YYY.ZZZ
• ~

More Related Content

What's hot

Git: from Novice to Expert
Git: from Novice to ExpertGit: from Novice to Expert
Git: from Novice to ExpertGoddy Zhao
 
Understanding GIT
Understanding GITUnderstanding GIT
Understanding GIThybr1s
 
Version Control with Git for Beginners
Version Control with Git for BeginnersVersion Control with Git for Beginners
Version Control with Git for Beginnersbryanbibat
 
Whats New in ASP.NET Core
Whats New in ASP.NET CoreWhats New in ASP.NET Core
Whats New in ASP.NET CoreJon Galloway
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshopthemystic_ca
 
PyCon KR 2019 sprint - RustPython by example
PyCon KR 2019 sprint  - RustPython by examplePyCon KR 2019 sprint  - RustPython by example
PyCon KR 2019 sprint - RustPython by exampleYunWon Jeong
 
Git Basics (Professionals)
 Git Basics (Professionals) Git Basics (Professionals)
Git Basics (Professionals)bryanbibat
 
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseSages
 
Parboiled explained
Parboiled explainedParboiled explained
Parboiled explainedPaul Popoff
 
Async Microservices with Twitter's Finagle
Async Microservices with Twitter's FinagleAsync Microservices with Twitter's Finagle
Async Microservices with Twitter's FinagleVladimir Kostyukov
 
Mysql5.1 character set testing
Mysql5.1 character set testingMysql5.1 character set testing
Mysql5.1 character set testingPhilip Zhong
 
Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8Philip Zhong
 
Mysql handle socket
Mysql handle socketMysql handle socket
Mysql handle socketPhilip Zhong
 
Synergy Database Cleaning
Synergy Database CleaningSynergy Database Cleaning
Synergy Database CleaningManageware
 

What's hot (20)

Git: from Novice to Expert
Git: from Novice to ExpertGit: from Novice to Expert
Git: from Novice to Expert
 
Understanding GIT
Understanding GITUnderstanding GIT
Understanding GIT
 
Version Control with Git for Beginners
Version Control with Git for BeginnersVersion Control with Git for Beginners
Version Control with Git for Beginners
 
Whats New in ASP.NET Core
Whats New in ASP.NET CoreWhats New in ASP.NET Core
Whats New in ASP.NET Core
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
PyCon KR 2019 sprint - RustPython by example
PyCon KR 2019 sprint  - RustPython by examplePyCon KR 2019 sprint  - RustPython by example
PyCon KR 2019 sprint - RustPython by example
 
Git Basics (Professionals)
 Git Basics (Professionals) Git Basics (Professionals)
Git Basics (Professionals)
 
Git commands
Git commandsGit commands
Git commands
 
Unqlite
UnqliteUnqlite
Unqlite
 
Kitura Todolist tutorial
Kitura Todolist tutorialKitura Todolist tutorial
Kitura Todolist tutorial
 
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
 
Parboiled explained
Parboiled explainedParboiled explained
Parboiled explained
 
Async Microservices with Twitter's Finagle
Async Microservices with Twitter's FinagleAsync Microservices with Twitter's Finagle
Async Microservices with Twitter's Finagle
 
Mysql5.1 character set testing
Mysql5.1 character set testingMysql5.1 character set testing
Mysql5.1 character set testing
 
Git Basic
Git BasicGit Basic
Git Basic
 
Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8
 
Mysql handle socket
Mysql handle socketMysql handle socket
Mysql handle socket
 
Synergy Database Cleaning
Synergy Database CleaningSynergy Database Cleaning
Synergy Database Cleaning
 
Git github
Git githubGit github
Git github
 
Git for the absolute beginners
Git for the absolute beginnersGit for the absolute beginners
Git for the absolute beginners
 

Viewers also liked

Viewers also liked (6)

El agua si
El agua siEl agua si
El agua si
 
云计算
云计算云计算
云计算
 
沙龙升级
沙龙升级沙龙升级
沙龙升级
 
Hadoop
HadoopHadoop
Hadoop
 
Shell奇技淫巧
Shell奇技淫巧Shell奇技淫巧
Shell奇技淫巧
 
Stay Up To Date on the Latest Happenings in the Boardroom: Recommended Summer...
Stay Up To Date on the Latest Happenings in the Boardroom: Recommended Summer...Stay Up To Date on the Latest Happenings in the Boardroom: Recommended Summer...
Stay Up To Date on the Latest Happenings in the Boardroom: Recommended Summer...
 

Similar to Git使用

Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control SystemVictor Wong
 
Learning Basic GIT Cmd
Learning Basic GIT CmdLearning Basic GIT Cmd
Learning Basic GIT Cmdsrinathcox
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.comdropsolid
 
Git Tutorial Yang Yang
Git Tutorial Yang YangGit Tutorial Yang Yang
Git Tutorial Yang YangYang Yang
 
Git Developer Cheatsheet
Git Developer CheatsheetGit Developer Cheatsheet
Git Developer CheatsheetAbdul Basit
 
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 2017Codemotion
 
Gitting It Under (Version) Control
Gitting It Under (Version) ControlGitting It Under (Version) Control
Gitting It Under (Version) Controlmobiledevnj
 
Git - Get Ready To Use It
Git - Get Ready To Use ItGit - Get Ready To Use It
Git - Get Ready To Use ItDaniel Kummer
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for ArtistsDavid Newbury
 
Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Brian K. Vagnini
 
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
 

Similar to Git使用 (20)

Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Learning Basic GIT Cmd
Learning Basic GIT CmdLearning Basic GIT Cmd
Learning Basic GIT Cmd
 
Git cheat sheet with diagram-5.pdf
Git cheat sheet with diagram-5.pdfGit cheat sheet with diagram-5.pdf
Git cheat sheet with diagram-5.pdf
 
Git
GitGit
Git
 
git - the basics
git - the basicsgit - the basics
git - the basics
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
 
Git foundation
Git foundationGit foundation
Git foundation
 
Git basics
Git basicsGit basics
Git basics
 
Git101
Git101Git101
Git101
 
Git Tutorial Yang Yang
Git Tutorial Yang YangGit Tutorial Yang Yang
Git Tutorial Yang Yang
 
Git
GitGit
Git
 
Git Developer Cheatsheet
Git Developer CheatsheetGit Developer Cheatsheet
Git Developer Cheatsheet
 
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
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
GIT_In_90_Minutes
GIT_In_90_MinutesGIT_In_90_Minutes
GIT_In_90_Minutes
 
Gitting It Under (Version) Control
Gitting It Under (Version) ControlGitting It Under (Version) Control
Gitting It Under (Version) Control
 
Git - Get Ready To Use It
Git - Get Ready To Use ItGit - Get Ready To Use It
Git - Get Ready To Use It
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for Artists
 
Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615
 
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
 

Recently uploaded

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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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 Scriptwesley chun
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
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
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Recently uploaded (20)

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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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 ...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
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
 
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...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

Git使用

  • 3. svn 较 •GIT •SVN • • • • • • • 长 • 长 •处 •处 较
  • 4. GIT
  • 5. 仓库 davidx-laptop:Projects davidx$ mkdir test davidx-laptop:Projects davidx$ cd test davidx-laptop:test davidx$ git init Initialized empty Git repository in /Users/davidx/Projects/test/.git/ davidx-laptop:test davidx$
  • 6. 仓库 davidx-laptop:test davidx$ touch README davidx-laptop:test davidx$ git add README davidx-laptop:test davidx$ git add test2/ davidx-laptop:test davidx$ git status # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # # new file: README # new file: test2/file1 # new file: test2/file2 # new file: test2/file3
  • 7. davidx-laptop:test davidx$ git commit -m "init commit" [master (root-commit) e55ac19] init commit 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 README create mode 100644 test2/file1 create mode 100644 test2/file2 create mode 100644 test2/file3
  • 8. 历 davidx-laptop:test davidx$ git log commit e55ac19e882cc3c931f2d844df14578c8109af8e Author: davidx <mykingheaven@gmail.com> Date: Tue Sep 21 15:35:59 2010 +0800 init commit
  • 9. 删 davidx-laptop:test davidx$ git rm test2/file1 rm 'test2/file1' davidx-laptop:test davidx$ git rm test2/file2 test2/file3 rm 'test2/file2' rm 'test2/file3' davidx-laptop:test davidx$ git commit -m "delete some files" [master 458781d] delete some files 0 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test2/file1 delete mode 100644 test2/file2 delete mode 100644 test2/file3
  • 11. • git reset SHA1 • git reset HEAD~1
  • 12. clone • git clone <git_url> <local_directory>
  • 13.
  • 14. davidx-laptop:test davidx$ git usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path] [-p|--paginate|--no-pager] [--no-replace-objects] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS] The most commonly used git commands are: add Add file contents to the index bisect Find by binary search the change that introduced a bug branch List, create, or delete branches checkout Checkout a branch or paths to the working tree clone Clone a repository into a new directory commit Record changes to the repository diff Show changes between commits, commit and working tree, etc fetch Download objects and refs from another repository grep Print lines matching a pattern init Create an empty git repository or reinitialize an existing one log Show commit logs merge Join two or more development histories together mv Move or rename a file, a directory, or a symlink pull Fetch from and merge with another repository or a local branch push Update remote refs along with associated objects rebase Forward-port local commits to the updated upstream head reset Reset current HEAD to the specified state rm Remove files from the working tree and from the index show Show various types of objects status Show the working tree status tag Create, list, delete or verify a tag object signed with GPG See 'git help COMMAND' for more information on a specific command.
  • 17. branch • GIT • 应该 • 结 , 应该merge
  • 18. branch • : git branch <branch name> • 换 : git checkout <branch name> • -- 换 该 : git checkout -b <branch name>
  • 19. branch davidx-laptop:test davidx$ git branch new davidx-laptop:test davidx$ git checkout new Switched to branch 'new' davidx-laptop:test davidx$ git branch master * new davidx-laptop:test davidx$ git checkout -b new2 Switched to a new branch 'new2' davidx-laptop:test davidx$ git branch master new * new2
  • 20. branch • : git branch • 删 : git branch -d <branch name> • master • 删
  • 21. branch • : git merge <source branch name> • 标 为
  • 22. branch davidx-laptop:test davidx$ git checkout new2 Switched to branch 'new2' davidx-laptop:test davidx$ touch new_file_2 davidx-laptop:test davidx$ git add new_file_2 davidx-laptop:test davidx$ git commit -a [new2 e69c6a9] new file: new_file_2 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 new_file_2 davidx-laptop:test davidx$ git checkout master Switched to branch 'master' davidx-laptop:test davidx$ git merge new2 Updating cb88fd0..e69c6a9 Fast-forward 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 new_file_2
  • 23.
  • 24. tag • 态 标 • branch • 为version发
  • 25. tag davidx-laptop:test davidx$ git tag davidx-laptop:test davidx$ git tag 1.0 davidx-laptop:test davidx$ git tag 1.0
  • 27. 问题 Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly: git config --global user.name "Your Name" git config --global user.email you@example.com If the identity used for this commit is wrong, you can fix it with: git commit --amend --author='Your Name <you@example.com>'
  • 28. GITCONFIG • ~/.gitconfig • [user] section • name=XXXX • email=XXXX@YYY.ZZZ
  • 29. GITCONFIG [user] name = davidx email = mykingheaven@gmail.com [core] editor = vim
  • 30. .gitignore • 录 .gitignore • *.XXX • XXX/YYY.ZZZ • ~

Editor's Notes