網站首頁 編程語言 正文
1. 打包
用git bundle create命令來打包
# dev指具體的分支名稱,repo指項目代碼倉庫的名稱 # 產生的repo.bundle 包含了所有重建該倉庫 dev分支所需的數據 git bundle create repo.bundle HEAD dev
2. 驗證
用git bundle verify校驗是否合法
此命令需要在項目代碼倉庫目錄下執行,否則會報:git bundle need a repository to verify a bundle
git bundle verify repo.bundle
3. 查看分支
#用git bundle list-heads列出頂端提交 git bundle list-heads repo.bundle #在遠程存儲庫中列出引用 git ls-remote repo.bundle
4. 導入bundle
4.1. 沒有gitlab服務器
開發環境中沒有gitlab服務器,修改代碼后只提交到本地
# 導入的項目沒有.git目錄 git clone repo.bundle
4.2. 有gitlab服務器
4.2.1 從bundle中clone
開發環境中沒有gitlab服務器,修改代碼后需要提交到gitlab服務器
- 在gitlab上創建代碼倉庫【注意:不要創建bundle中的分支】
- 從bundle包中clone?
git clone repo.bundle
cd 倉庫目錄
- 執行如下命令
git remote rename origin old-origin git remote add origin http://ip:port/xxx/xx.git git push -u origin -all git push -u origin --tags
4.2.2 從bundle中fetch
開發環境中沒有gitlab服務器,修改代碼后需要提交到gitlab服務器
- 在gitlab上創建代碼倉庫【注意:
不要創建bundle中的分支
】 - 將代碼倉庫clone到本地,
cd 倉庫目錄
- fetch bundle中的分支
# 前面的dev是repo.bundle的分支,后面的dev是生成的新分支 git fetch repo.bundle dev:dev
將本地分支同遠程分支進行關聯
git push -u origin dev # 相同作用的命令 git push --set-upstream origin dev
如何將本地分支同遠程分支進行關聯 本地已經創建了分支而遠程沒有
可以通過以下2種方法在遠程創建分支dev,并與本地分支進行關聯:
- 方法1: git push -u origin dev
- 方法2: git push --set-upstream origin dev
在本地創建分支并與遠程分支進行關聯,也有2種方法:
- 方法1: 分為兩步:
- step1:先將遠程分支pull到本地 git pull origin dev
- step2:再在本地創建分支并與之關聯,又有2種方法
git checkout -b dev origin/dev
git checkout -b dev --track origin/dev #可以簡寫為git checkout --track origin/dev
- 方法2:可以在pull遠程分支的同時,創建本地分支并與之進行關聯
git pull origin dev:dev-------兩個dev分別表示遠程分支名:本地分支名
原文鏈接:https://blog.csdn.net/penriver/article/details/126579266
相關推薦
- 2022-05-12 databinding 與 RecyclerView.Adapter
- 2022-05-09 Python的數據結構與算法的隊列詳解(3)_python
- 2022-04-17 python使用openpyxl讀取日期并修改excel
- 2024-04-06 jeecg-boot使用QueryGenerator.initQueryWrapper怎么排序查詢
- 2022-04-05 vxe-table中vxe-grid的使用
- 2022-10-13 Android自定義View實現簡單水波紋效果_Android
- 2022-07-28 使用正則表達式從鏈接中獲取圖片名稱_正則表達式
- 2022-08-06 為Visual?Studio手工安裝微軟ReportViewer控件_自學過程
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支