创建Git仓库
两种场景:
1.把已有的项目代码纳入Git管理
$ cd 项目代码所在的文件夹 $ git init
|
2.新建的项目直接用Git管理
$ cd 某个文件夹 $ git init your_project $ cd your_project
|
创建一个仓库,设置local配置
$ git init LocalTest Initialized empty Git repository in /Users/jamme/Documents/WorkSpace/GitTest/LocalTest/.git/ $ ls LocalTest $ cd LocalTest/ $ git config --local user.name 'xxx' $ git config --local user.email 'xxx@xxx.com' $ git config --local --list core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true core.ignorecase=true core.precomposeunicode=true user.name=xxx user.email=xxx@xxx.com
|
提交一个文件,并查看状态及日志
$ cp ../readme . $ git add readme $ git status On branch master
No commits yet
Changes to be committed: (use "git rm --cached <file>..." to unstage)
new file: readme
$ git commit -m'Add readme' [master (root-commit) 33f7ae4] Add readme 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 readme $ git log commit 33f7ae4c4d4da85453ed0077670e242b71d0a621 (HEAD -> master) Author: xxx <xxx@xxx.com> Date: Sun Apr 28 22:19:09 2019 +0800
Add readme
|