zoukankan      html  css  js  c++  java
  • Git学习笔记(4) — 基本命令

    git init

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

    git clone

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

    命令格式

    1 git clone [--template=<template_directory>] [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror] [-o <name>] [-u <upload-pack>] [--reference <repository>] [--depth <depth>] [--] <repository> [<directory>]

    在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

  • 相关阅读:
    [51nod 1129] 字符串最大值(kmp)
    P3391 【模板】文艺平衡树(Splay)
    次大公约数
    青蛙的约会
    [HNOI2002]营业额统计
    GYM 100741A Queries
    P3370 【模板】字符串哈希
    P3369 【模板】普通平衡树(Treap/SBT)
    05:LGTB 与偶数
    简单计算器
  • 原文地址:https://www.cnblogs.com/chenbin7/p/2625886.html
Copyright © 2011-2022 走看看