git clone 一些简单笔记

本文详细介绍了 Git Clone 命令的各种参数及其用法,包括如何指定克隆的目标目录、创建新的分支、克隆远程分支等内容。适用于初学者快速上手及进阶用户深入理解 Git 的工作原理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文地址为: git clone 一些简单笔记

自使用了git后,就彻底喜欢上了,深深体会到了自由的感觉,记录一些简单笔记和使用心得,仅供留迹,以备后查。。。

git clone 命令参数:

usage: git clone [options] [--] <repo> [<dir>]

-v, --verbose be more verbose
-q, --quiet be more quiet
--progress force progress reporting
-n, --no-checkout don't create a checkout
--bare create a bare repository
--mirror create a mirror repository (implies bare)
-l, --local to clone from a local repository
--no-hardlinks don't use local hardlinks, always copy
-s, --shared setup as shared repository
--recursive initialize submodules in the clone
--recurse-submodules initialize submodules in the clone
--template <template-directory>
directory
from which templates will be used
--reference <repo> reference repository
-o, --origin <name> use <name> instead of 'origin' to track upstream
-b, --branch <branch>
checkout
<branch> instead of the remote's HEAD
-u, --upload-pack <path>
path to git
-upload-pack on the remote
--depth <depth> create a shallow clone of that depth
--separate-git-dir <gitdir>
separate git dir
from working tree
-c, --config <key=value>
set config inside the new repository

参数挺多,但常用的就几个:

1. 最简单直接的命令

git clone xxx.git

2. 如果想clone到指定目录

git clone xxx.git "指定目录"

3. clone时创建新的分支替代默认Origin HEAD(master)

git clone -b [new_branch_name]  xxx.git

4. clone 远程分支

  git clone 命令默认的只会建立master分支,如果你想clone指定的某一远程分支(如:dev)的话,可以如下:

  A. 查看所有分支(包括隐藏的)  git branch -a 显示所有分支,如:    

* master
remotes
/origin/HEAD -> origin/master
remotes
/origin/dev
remotes
/origin/master

  B.  在本地新建同名的("dev")分支,并切换到该分支

git checkout -t origin/dev 该命令等同于:
git checkout -b dev origin/dev

转载请注明本文地址: git clone 一些简单笔记
根据你提供的信息,出现"飞浆git clone invalid syntax"错误可能是由于语法错误导致的。在Python中,语法错误通常是由于代码中有错误的字符或格式问题引起的。 然而,根据提供的引用内容,没有直接涉及到"飞浆git clone invalid syntax"错误。引用提到了关于在终端上使用git clone时无法成功clone项目的问题,而引用提到了编辑git配置文件的方法。这些引用内容与"飞浆git clone invalid syntax"错误并没有直接关联。 为了解决"飞浆git clone invalid syntax"错误,建议您检查一下代码中是否存在语法错误。确保代码中的语法正确,并且没有遗漏的括号、引号或其他特殊字符。此外,还可以尝试更新你的飞浆库版本,以确保使用的是最新的稳定版本。 如果问题仍然存在,请提供更多详细的错误信息,以便我可以更好地帮助你解决问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [git clone 报错解决](https://blog.youkuaiyun.com/wangwangstone/article/details/130803697)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *3* [【Python学习笔记】报错invalid syntax](https://blog.youkuaiyun.com/bailichen800/article/details/127787359)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值