[关闭]
@Sarah 2015-05-24T08:40:04.000000Z 字数 2538 阅读 1312

git hub / git 简易教程

未分类


在此输入正文

git初步设置


  1. //打开终端
  2. Last login: Sun May 24 09:02:37 on console
  3. appledeMacBook-Pro:~ apple$ git
  4. xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
  5. appledeMacBook-Pro:~ apple$ git
  6. usage: git [--version] [--help] [-C <path>] [-c name=value]
  7. [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
  8. [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
  9. [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
  10. <command> [<args>]
  11. The most commonly used git commands are:
  12. //常用命令
  13. add Add file contents to the index
  14. bisect Find by binary search the change that introduced a bug
  15. branch List, create, or delete branches
  16. checkout Checkout a branch or paths to the working tree
  17. clone Clone a repository into a new directory
  18. commit Record changes to the repository
  19. diff Show changes between commits, commit and working tree, etc
  20. fetch Download objects and refs from another repository
  21. grep Print lines matching a pattern
  22. init Create an empty Git repository or reinitialize an existing one
  23. log Show commit logs
  24. merge Join two or more development histories together
  25. mv Move or rename a file, a directory, or a symlink
  26. pull Fetch from and integrate with another repository or a local branch
  27. push Update remote refs along with associated objects
  28. rebase Forward-port local commits to the updated upstream head
  29. reset Reset current HEAD to the specified state
  30. rm Remove files from the working tree and from the index
  31. show Show various types of objects
  32. status Show the working tree status
  33. tag Create, list, delete or verify a tag object signed with GPG
  34. 'git help -a' and 'git help -g' list available subcommands and some
  35. concept guides. See 'git help <command>' or 'git help <concept>'
  36. to read about a specific subcommand or concept.
  37. appledeMacBook-Pro:~ apple$ mkdir github//make direction
  38. appledeMacBook-Pro:~ apple$ cd github//change direction
  39. appledeMacBook-Pro:github apple$ ls//显示
  40. appledeMacBook-Pro:github apple$ mkdir cheery
  41. appledeMacBook-Pro:github apple$ cd cheery
  42. appledeMacBook-Pro:cheery apple$ git init//初始化
  43. Initialized empty Git repository in /Users/apple/github/cheery/.git/
  44. appledeMacBook-Pro:cheery apple$ git status//当前状态
  45. On branch master
  46. Initial commit
  47. Untracked files:
  48. (use "git add <file>..." to include in what will be committed)
  49. Function.java
  50. nothing added to commit but untracked files present (use "git add" to track)
  51. appledeMacBook-Pro:cheery apple$ git add Function.java
  52. appledeMacBook-Pro:cheery apple$ git status
  53. On branch master
  54. Initial commit
  55. Changes to be committed:
  56. (use "git rm --cached <file>..." to unstage)
  57. new file: Function.java
  58. appledeMacBook-Pro:cheery apple$ git commit -m "init project"//添加一条评论
  59. [master (root-commit) 7ea5e35] init project
  60. 1 file changed, 30 insertions(+)
  61. create mode 100644 Function.java
  62. appledeMacBook-Pro:cheery apple$
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注