日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

github --- 多个项目的管理方式

發(fā)布時間:2023/12/10 编程问答 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 github --- 多个项目的管理方式 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

1. 多個項目管理方式

  • 進入項目根目錄: git init

  • 將當前的項目添加到暫存區(qū)中: git add . (注意: 最后有一個點)

  • 將暫存區(qū)的內(nèi)容放到本地倉庫: git commit -m '初始化項目'

  • 登錄github , 新建遠程倉庫

  • 在本地添加遠程倉庫的源: git remote origin https://github.com/Lizhhhh/miniProgram.git

  • 將本地代碼提交到遠程: git push -u origin master

  • 1.1 給提交的代碼添加標簽,并提交到遠程

    • 假設現(xiàn)在,我們在本地修改好了代碼:
  • 將代碼保存到暫存區(qū) git add .
  • 暫存到本地: git commit -m '知識點1'
  • 上標記: git tag 01_知識點1
  • 通過git tag來查看項目中的標簽.
  • $ git tag 01_知識點1
    • 查看項目中有哪些提交: git log
    commit 75c6d6bdfa063322ce728b98ab4dc20724efc02d (HEAD -> master, tag: 01_知識點1) Author: 栗子好好吃 <543288744@qq.com> Date: Sat Feb 15 13:58:23 2020 +0800知識點1commit f98bf38a589ce6c696a844f41a81be9e554714ba (origin/master) Author: 栗子好好吃 <543288744@qq.com> Date: Sat Feb 15 14:41:22 2020 +0800初始化項目
  • 找到項目初始化的id,然后進行版本回退: git reset --hard f98bf38

  • 此時項目處于初始化的狀態(tài).你可以對項目進行修改…

  • 修改完成后,將新的代碼提交到本地:git add . --> git commit -m '知識點2' --> git tab 02_知識點2

  • 此時: git tag, 當前的代碼僅在本地,而在遠程中沒有.下面需要將tags推到遠程中

  • $ git tag 01_知識點1 02_知識點2
  • git push --tags
  • $ git push --tags Enumerating objects: 14, done. Counting objects: 100% (14/14), done. Delta compression using up to 8 threads Compressing objects: 100% (10/10), done. Writing objects: 100% (10/10), 869 bytes | 434.00 KiB/s, done. Total 10 (delta 6), reused 0 (delta 0) remote: Resolving deltas: 100% (6/6), completed with 2 local objects. To https://github.com/Lizhhhh/miniProgram.git* [new tag] 01_知識點1 -> 01_知識點1* [new tag] 02_知識點2 -> 02_知識點2
  • 此時可以在git遠程倉庫中的Branch中找到對應的tags.來完成項目的遠程拷貝
  • 1.2 從遠程將項目拷貝下來

  • 登錄遠程倉,找到克隆的地址: https://github.com/Lizhhhh/miniProgram.git

  • 將遠程倉庫的代碼拷貝到本地: git clone

  • $ git clone https://github.com/Lizhhhh/miniProgram.git Cloning into 'miniProgram'... remote: Enumerating objects: 26, done. remote: Counting objects: 100% (26/26), done. remote: Compressing objects: 100% (16/16), done. remote: Total 26 (delta 8), reused 25 (delta 7), pack-reused 0 Unpacking objects: 100% (26/26), done.
  • 現(xiàn)在假設想查看tag 01_知識點1的代碼,可以在命令行輸入:git checkout 01_知識點1
  • $ git checkout 01_知識點1 Note: checking out '01_知識點1'.You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example:git checkout -b <new-branch-name>HEAD is now at 4e8281e 知識點1 M app.json M project.config.json
  • 現(xiàn)在假設想查看tag 02_知識點2的代碼,可以在命令行輸入:git checkout 02_知識點2
  • $ git checkout 02_知識點2 Previous HEAD position was 4e8281e 知識點1 HEAD is now at 75c6d6b 知識點2 M app.json M project.config.json

    總結

    以上是生活随笔為你收集整理的github --- 多个项目的管理方式的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。