您现在的位置是:网站首页> 编程资料编程资料
Git中bundle命令的使用详解_相关技巧_
2023-05-25
350人已围观
简介 Git中bundle命令的使用详解_相关技巧_
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分别表示远程分支名:本地分支名
到此这篇关于Git中bundle命令的使用的文章就介绍到这了,更多相关Git中bundle命令内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!
相关内容
- VS Code 常用自定义配置代码规范保存自动格式化_相关技巧_
- 关于401状态码的含义和处理方式_相关技巧_
- VSCode报错:Vetur can't find 'tsconfig.json' or 'jsconfig.json'解决办法_相关技巧_
- github访问速度慢的问题完美解决_相关技巧_
- eWebEditor 辑器按钮失效 IE8下eWebEditor编辑器无法使用的解决方法_网页编辑器_
- fckeditor 代码语法高亮_网页编辑器_
- HTML 编辑器 FCKeditor使用详解_网页编辑器_
- FCKEditor SyntaxHighlighter整合实现代码高亮显示_网页编辑器_
- FCKeditor ASP.NET 上传附件研究_网页编辑器_
- fckeditor 常用函数_网页编辑器_
