天天看点

GitHub实战系列~4.把github里面的库克隆到指定目录+日常使用 2015-12-11

GitHub实战系列汇总:http://www.cnblogs.com/dunitian/p/5038719.html

——————————————————————————————————————————————————————

很多人问,明明有git gui 和 github可以直接图形化操作的吗?全部指令干啥???

呃(⊙o⊙)…呃(⊙o⊙)… ===> 装逼~

O(∩_∩)O~,开玩笑的,其实就是为了通用和熟悉git,linux里面照样这样用,多熟悉点基础指令很有用的,

———————————————————————————————————————————————————————

1.把github里面的库克隆到指定目录

格式:git clone ssh地址 "路径" (命令不清楚的可以用linux查看命令的方法 git clone --help)

GitHub实战系列~4.把github里面的库克隆到指定目录+日常使用 2015-12-11

$ git clone [email protected]:dunitian/Windows10.git "F:/Work/WP/Windows10"

Cloning into 'F:/Work/WP/Windows10'...

remote: Counting objects: 729, done.

remote: Total 729 (delta 0), reused 0 (delta 0), pack-reused 729

Receiving objects: 100% (729/729), 5.58 MiB | 702.00 KiB/s, done.

Resolving deltas: 100% (470/470), done.

Checking connectivity... done.

2.切换到指定目录[两种方法] (windows不区分大小写,Linux就要注意了)

方法一:命令 cd f:/work/wp/windows10  (Linux通用)

方法二:在目录右键 git bash here (仅限windows)

GitHub实战系列~4.把github里面的库克隆到指定目录+日常使用 2015-12-11

3.查看一下状态和日记(做完每一步都可以看看,新手多用用,每次提交的时候多用用)

GitHub实战系列~4.把github里面的库克隆到指定目录+日常使用 2015-12-11

DNT@DESKTOP-PTACRF6 MINGW64 /f/work/wp/windows10 (master)

$ git status

On branch master (在master分支里面)

Your branch is up-to-date with 'origin/master'.

nothing to commit, working directory clean (没有提交)

$ git log (提交日记)

commit 1bb5aa4761f9775d8590668115d9cf14a0148100

Author: dunitian <[email protected]>

Date: Thu Dec 10 12:14:16 2015 +0800

逆天WP-Win10开发笔记源码(学习ing)

4.实战一下使用status和log(添加文件)

  4.1 添加一个文件 temp.dnt  ==> vi temp.dnt  (进入命令模式后,按i进行编辑,编辑完后按esc 再输入 :wq)

  4.2 查看一下状态 git status  ==>temp.dnt 待提交,使用 git add命令继续跟踪

  

GitHub实战系列~4.把github里面的库克隆到指定目录+日常使用 2015-12-11

  4.3 把文件添加到暂存区 git add temp.dnt

  4.4 查看一下状态 git status  ==> 一个新文件 temp.dnt,使用 git reset 可以恢复

GitHub实战系列~4.把github里面的库克隆到指定目录+日常使用 2015-12-11

  4.5 把文件提交到本地库中 git commit -m "注释"

  4.6 查看一下状态 git status ==> 没有什么可以再提交了可以使用git push 把代码托管到 github网站上

GitHub实战系列~4.把github里面的库克隆到指定目录+日常使用 2015-12-11

  4.7 把文件提交到github  git push

  4.8 查看状态 git status ==> 提交到管理员主分支了,没有什么可以提交的了

GitHub实战系列~4.把github里面的库克隆到指定目录+日常使用 2015-12-11

  4.9 查看一下提交日记 git log

GitHub实战系列~4.把github里面的库克隆到指定目录+日常使用 2015-12-11

5.实战一下使用status和log(删除文件)

和上面差不多,我就简写了:

  5.1 git rm temp.dnt (删除所有:git rm -rf * [命令不理解就看看==>Linux基础教程]) 

GitHub实战系列~4.把github里面的库克隆到指定目录+日常使用 2015-12-11

  5.2 git commit -m "注释"【推荐使用git xxx删除或者修改,这样就可以直接提交,不然得加上-a选项:git commit -a -m "xx"】

GitHub实战系列~4.把github里面的库克隆到指定目录+日常使用 2015-12-11

  5.3 git push 

GitHub实战系列~4.把github里面的库克隆到指定目录+日常使用 2015-12-11

  5.4 查看提交记录 git log

GitHub实战系列~4.把github里面的库克隆到指定目录+日常使用 2015-12-11

文件木有了:

GitHub实战系列~4.把github里面的库克隆到指定目录+日常使用 2015-12-11

下节预告:创建分支,恢复历史版本,消除冲突,修改提交信息,获取远程最新仓库分支等

作者:毒逆天

出处:https://www.cnblogs.com/dotnetcrazy

打赏:<b>18i4JpL6g54yAPAefdtgqwRrZ43YJwAV5z</b>

本文版权归作者和博客园共有。欢迎转载,但必须保留此段声明,且在文章页面明显位置给出原文连接!

继续阅读