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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章