Github经验

从本地工作目录目录创建

  1. 本地创建
git init
git add .
git commit -m ""
touch .gitignore
  1. 在github上创建空的repository,并拷贝对应的地址repository-url
  2. 连接本地工作目录与远程url
git remote add origin remote repository-url
git remote -v
git push -u origin master

从github创建

  1. 在github上创建空的repository,并拷贝对应的地址repository-url
  2. 本地创建
git clone repository-url
git touch 
git add 
git commit
git push

在git库的工作目录下添加新的git库工作目录

https://github.blog/2016-02-01-working-with-submodules/

  1. 进入当前工作目录下的子目录
cd subDir
git submodule add subRepository-url newDir

基于工作目录下子目录创建新的git库

https://help.github.com/en/github/using-git/splitting-a-subfolder-out-into-a-new-repository

  1. 拆分工作目录
git clone repository-url
cd repository-dir
git filter-branch --prune-empty --subdirectory-filter FOLDER-NAME BRANCH-NAME (master or gh-pages)
  1. 在github上创建repository,并拷贝repository-url
  2. 连接本地子目录和新的repository
git remote -v
git remote set-url origin new-repository-url (更新子目录关联的repository)
git remote -v
git push -u origin BRANCH-NAME

参考

https://www.git-tower.com/learn/git/ebook/en/command-line/advanced-topics/submodules

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值