Your SlideShare is downloading. ×
0
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Git使用
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Git使用

1,530

Published on

GIT使用简介

GIT使用简介

Published in: Technology, Business
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,530
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
20
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide




























  • Transcript

    • 1. git davidx <mykingheaven@gmail.com>
    • 2. git • SCM • • •
    • 3. 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
    • 10. 销 davidx-laptop:test davidx$ git checkout README
    • 11. • git reset SHA1 • git reset HEAD~1
    • 12. clone • git clone <git_url> <local_directory>
    • 13. 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.
    • 14. git 级
    • 15. • push • pull
    • 16. branch • GIT • 应该 • 结 , 应该merge
    • 17. branch • : git branch <branch name> • 换 : git checkout <branch name> • -- 换 该 : git checkout -b <branch name>
    • 18. 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
    • 19. branch • : git branch • 删 : git branch -d <branch name> • master • 删
    • 20. branch • : git merge <source branch name> • 标 为
    • 21. 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
    • 22. tag • 态 标 • branch • 为version发
    • 23. tag davidx-laptop:test davidx$ git tag davidx-laptop:test davidx$ git tag 1.0 davidx-laptop:test davidx$ git tag 1.0
    • 24. 问题
    • 25. 问题 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>'
    • 26. GITCONFIG • ~/.gitconfig • [user] section • name=XXXX • email=XXXX@YYY.ZZZ
    • 27. GITCONFIG [user] name = davidx email = mykingheaven@gmail.com [core] editor = vim

    ×