$ mkdir runoob $ cd runoob/ $ git init Initialized empty Git repository in /Users/tianqixin/www/runoob/.git/ # 在 /www/runoob/.git/ 目录初始化空 Git 仓库完毕
$ git clone git@github.com:schacon/simplegit.git Cloning into 'simplegit'... remote: Counting objects: 13, done. remote: Total 13 (delta 0), reused 0 (delta 0), pack-reused 13 Receiving objects: 100% (13/13), done. Resolving deltas: 100% (2/2), done. Checking connectivity... done.
$ ls -a . .. .git README Rakefile lib $ cd .git $ ls HEAD description info packed-refs branches hooks logs refs config index objects
$ touch README $ touch hello.php $ ls README hello.php $ git status -s ?? README ?? hello.php $
$ git status -s A README A hello.php $
$ vim README <pre> <p>在 README 添加以下内容:<b># Runoob Git 测试</b>,然后保存退出。</p> <p>再执行一下 git status:</p> $ git status -s AM README A hello.php
$ git add . $ git status -s A README A hello.php
$ git status On branch master Initial commit Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: README new file: hello.php
<?php echo '菜鸟教程:www.runoob.com'; ?>
$ git status -s A README AM hello.php $ git diff diff --git a/hello.php b/hello.php index e69de29..69b5711 100644 --- a/hello.php +++ b/hello.php @@ -0,0 +1,3 @@ +<?php +echo '菜鸟教程:www.runoob.com'; +?>
$ git add hello.php $ git status -s A README A hello.php $ git diff --cached diff --git a/README b/README new file mode 100644 index 0000000..8f87495 --- /dev/null +++ b/README @@ -0,0 +1 @@ +# Runoob Git 测试 diff --git a/hello.php b/hello.php new file mode 100644 index 0000000..69b5711 --- /dev/null +++ b/hello.php @@ -0,0 +1,3 @@ +<?php +echo '菜鸟教程:www.runoob.com'; +?>
$ git add hello.php $ git status -s A README A hello.php $ $ git commit -m '第一次版本提交' [master (root-commit) d32cf1f] 第一次版本提交 2 files changed, 4 insertions(+) create mode 100644 README create mode 100644 hello.php
# Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: hello.php # ~ ~ ".git/COMMIT_EDITMSG" 9L, 257C
<?php echo '菜鸟教程:www.runoob.com'; echo '菜鸟教程:www.runoob.com'; ?>
git commit -am '修改 hello.php 文件' [master 71ee2cb] 修改 hello.php 文件 1 file changed, 1 insertion(+)
<?php echo '菜鸟教程:www.runoob.com'; echo '菜鸟教程:www.runoob.com'; echo '菜鸟教程:www.runoob.com'; ?>
$ git status -s M README M hello.php $ git add . $ git status -s M README M hello.pp $ git reset HEAD -- hello.php Unstaged changes after reset: M hello.php $ git status -s M README M hello.php
$ git commit -m '修改' [master f50cfda] 修改 1 file changed, 1 insertion(+) $ git status -s M hello.php
$ git commit -am '修改 hello.php 文件' [master 760f74d] 修改 hello.php 文件 1 file changed, 1 insertion(+) $ git status On branch master nothing to commit, working directory clean
$ git rm hello.php rm 'hello.php' $ ls README
$ git rm --cached README rm 'README' $ ls README
$ git mv README README.md $ ls README.md
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有