首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >Git学习笔记(4) -- 基本命令

Git学习笔记(4) -- 基本命令

作者头像
EltonZheng
发布2021-01-22 07:34:30
发布2021-01-22 07:34:30
3470
举报

git init

初始化一个本地目录,加入版本管理

git clone

克隆一个版本库(repository)到一个新的目录

命令格式

代码语言:javascript
复制
git clone [--template=] [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror] [-o ] [-u ] [--reference ] [--depth ] [--]  []
</pre>

在clone后, 执行不带参数的git fetch的命令将更新远端的任何branches, 而执行不带参数的git pull的命令将merge远程的master branch到当前master branch

 表示要clone的仓库名称,可以是本地或者远程的。 仓库可以由以下几种表现方式:
    rsync://host.xz/path/to/repo.git/
    http://host.xz[:port]/path/to/repo.git/
    https://host.xz[:port]/path/to/repo.git/
    git://host.xz[:port]/path/to/repo.git/
    git://host.xz[:port]/~user/path/to/repo.git/
    ssh://[user@]host.xz[:port]/path/to/repo.git/
    ssh://[user@]host.xz/path/to/repo.git/
    ssh://[user@]host.xz/~user/path/to/repo.git/
    ssh://[user@]host.xz/~/path/to/repo.git

其中ssh是默认协议,所以如果使用ssh协议可以不写ssh的协议名

如果使用本地仓库,可以使用以下路径:
    /path/to/repo.git/
    file:///path/to/repo.git/
使用以上仓库路径,就相当于显式的使用了-l或-local参数

 表示你本地的路径名,会将远程的仓库的内容clone这个目录里面。

参考:
Everyday GIT With 20 Commands Or So

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • git init
  • git clone
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档