发布时间:2026/7/9 15:01:15
代码版本管理工具repogit常用命令
代码版本管理工具repogit常用命令repo常用命令repo相关操作repo构建本地版本管理repo分支管理操作repo遍历所有project 执行git命令操作repo manifest 管理repo sync -l 拉取本地分支基于当前分支创建新分支git 常用命令git命令参数git代码审核配置git 强制回退到某提交git取消提交文件跟踪git取消恢复文件跟踪git删除提交文件或目录git提交本地分支到远程仓库git保存用户密码git查看远端分支git更改远端仓库git补丁文件生成与应用:切换远程分支Git报错解决Git查看配置列表信息Git 配置和删除配置Git版本代码拷贝后所有文件每行都多个^M提交不了可以设置如下参数权限缓存输入一次正确的账号密码之后的git操作就不用每次输入账号密码了error: RPC failed; curl 18 transfer closed with outstanding read data remaininggit 提交部分修改文件repo常用命令Android SDK源码使用repo管理版本repo命令参数abandon Permanently abandon a development branch branch View current topic branches branches View current topic branches checkout Checkout a branch for development cherry-pick Cherry-pick a change. diff Show changes between commit and working tree diffmanifests Manifest diff utility download Download and checkout a change forall Run a shell command in each project gitc-delete Delete a GITC Client. gitc-init Initialize a GITC Client. grep Print lines matching a pattern help Display detailed help on a command info Get info on the manifest branch, current branch or unmerged branches init Initialize repo in the current directory list List projects and their associated directories manifest Manifest inspection utility overview Display overview of unmerged project branches prune Prune (delete) already merged topics rebase Rebase local branches on upstream branch selfupdate Update repo to the latest version smartsync Update working tree to the latest known good revision stage Stage file(s) for commit start Start a new branch for development status Show the working tree status sync Update working tree to the latest revision upload Upload changes for code review version Display the version of reporepo相关操作repo构建本地版本管理$repo init -u [OPTIONS]在当前目录下初始化repo会在当前目录生生成一个.repo目录像Git Project下的.git一样-u指定url可以加参数-m指定manifest文件默认是default.xml.repo/manifests保存manifest文件。.repo/projects下有所有的project的数据信息repo是一系列git project的集合每个git project下的.git目录中的refs等目录都是链接到.repo/manifests下的。$repo init xxxxx // 初始化repo$repo sync //同步远程仓库代码下载代码。$repo start newbranch --all //创建repo分支 --all所有manifest project, 也可以指定project.$repo checkout otherbranch //检出到otherbranch分支,$repo diff //显示差异只对已跟踪的文件有效$repo status //显示当前分支状态第一个字符表示暂存区的状态。no change same in HEAD and indexA added not in HEAD, in indexM modified in HEAD, modified in indexD deleted in HEAD, not in indexR renamed not in HEAD, path changed in indexC copied not in HEAD, copied from another in indexT mode changed same content in HEAD and index, mode changedU unmerged conflict between HEAD and index; resolution required第二个字符表示工作区的状态letter meaning descriptionnew/unknown not in index, in work treem modified in index, in work tree, modifiedd deleted in index, not in work treerepo分支管理操作$repo prune //删除已经merge的分支$repo abandon //删除分支无论是否merged,比较危险建议少用$repo branch或repo branches //查看所有分支$repo upload //上传本地提交至服务器//$repo forall [PROJECT_LIST]-c COMMAND//对指定的Project列表或所有Project执行命令COMMAND加上-p参数可打印出Project的路径。repo遍历所有project 执行git命令操作$repo forall -c$repo forall -c git merge other // 将other分支合并到当前分支$repo forall -c git branch -m oldname newname //重命名分支$repo forall -c git branc -D branchname //删除分支repo manifest 管理$repo manifest //可以根据当前各Project的版本信息生成一个manifest文件$repo manifest -o - //查看manifest 清单repo sync -l 拉取本地分支$repo sync -l #拉取本地分支后$repo start master --all # 创建分支repo sync拉取分支后repo branch和所有仓库下面执行git branch 都显示“no branches”这是正常的。.repo/manifests/default.xml中revision定义的版本进行更新的我们默认定义的是master它是按master对应的revision更新的无branch后续必须执行repo start 分支名 --all 建分支才能开发。基于当前分支创建新分支$ .repo/repo/repo forall -c git checkout -b ota-debuggit 常用命令download gitgit命令参数add clone fetch-pack ls-files notes remote-http stash add--interactive column filter-branch ls-remote p4 remote-https status am commit fmt-merge-msg ls-tree pack-objects remote-testsvn stripspace annotate commit-tree for-each-ref mailinfo pack-redundant repack submodule apply config format-patch mailsplit pack-refs replace subtree archive count-objects fsck merge patch-id request-pull symbolic-ref bisect credential fsck-objects merge-base prune rerere tag bisect--helper credential-cache gc merge-file prune-packed reset unpack-file blame credential-cache--daemon get-tar-commit-id merge-index pull rev-list unpack-objects branch credential-store grep merge-octopus push rev-parse update-index bundle daemon hash-object merge-one-file quiltimport revert update-ref cat-file describe help merge-ours read-tree rm update-server-info check-attr diff http-backend merge-recursive rebase send-pack upload-archive check-ignore diff-files http-fetch merge-resolve receive-pack sh-i18n--envsubst upload-pack check-mailmap diff-index http-push merge-subtree reflog shell var check-ref-format diff-tree imap-send merge-tree relink shortlog verify-pack checkout difftool index-pack mergetool remote show verify-tag checkout-index difftool--helper init mktag remote-ext show-branch web--browse cherry fast-export init-db mktree remote-fd show-index whatchanged cherry-pick fast-import instaweb mv remote-ftp show-ref write-tree clean fetch log name-rev remote-ftps stageThe most commonly used git commands are: add Add file contents to the index bisect Find by binary search the change that introduced a bug branch List, create, or delete branches checkout Checkout a branch or paths to the working tree clone Clone a repository into a new directory commit Record changes to the repository diff Show changes between commits, commit and working tree, etc fetch Download objects and refs from another repository grep Print lines matching a pattern init Create an empty Git repository or reinitialize an existing one log Show commit logs merge Join two or more development histories together mv Move or rename a file, a directory, or a symlink pull Fetch from and integrate with another repository or a local branch push Update remote refs along with associated objects rebase Forward-port local commits to the updated upstream head reset Reset current HEAD to the specified state rm Remove files from the working tree and from the index show Show various types of objects status Show the working tree status tag Create, list, delete or verify a tag object signed with GPGgit代码审核配置可以使用下面的配置来关闭代码检查:git config core.autocrlf truegit config core.safecrlf true还可以在提交代码时禁止代码检查git commit --no-verify-a或者可以这样做git config core.whitespace “trailing-space,space-before-tab”git config apply.whitespace “trailing-space,space-before-tab”还有另外一个办法就是在pre-commit添加如下语句if(/\s$/){#bad_line(“trailing whitespace”, $_);}git 强制回退到某提交退回到某一提交要慎用会删掉退回处之前的所有提交git reset --hard commit_idgit取消提交文件跟踪git rm --cached abc.txt # 不在跟踪abc.txt文件git取消恢复文件跟踪git update-index --assume-unchanged test.c # 不再追踪文件改动git update-index --no-assume-unchanged text.c # 恢复追踪文件改动git删除提交文件或目录git 删除被管理的文件 git rm --cached text.cgit 删除被管理的目录 git rm -r -f --cached src/demo/git提交本地分支到远程仓库git remote add origin in http://192.168.199.111:9090/git/xxx/xxx_linux.gitgit push -u origin mastergit push -f origin master //(non-fast-forward)出现冲突强推git push origin test:master // 提交本地test分支作为远程的master分支git push origin test:test // 提交本地test分支作为远程的test分支git保存用户密码git config --global credential.helper storegit查看远端分支git branch -rfetch远程demo分支到本地test分支,(test分支原先并不存在)git fetch origin demo:testgit更改远端仓库git remote remove origingit remote add origin gitxxx:xxx.gitgit push origin mastergit补丁文件生成与应用:生成补丁方法1 $git format-patch 9cd15047c* //生成当前提交之前的差分补丁方法2 $git show 4ff7d9ce* 0001.patch //生成本次提交的差分补丁文件名为0001.patch手动打补丁:先检查patch文件git apply --stat newpatch.patch检查能否应用成功git apply --check newpatch.patch打补丁git am --signoff newpatch.patch (使用-s或–signoff选项可以commit信息中加入Signed-off-by信息)以上命令打补丁失败有冲突可以手动打补丁:$patch -p1 0002-1.patchgit format-patch:$ git format-patch HEAD^ #生成最近的1次commit的patch$ git format-patch HEAD^^ #生成最近的2次commit的patch$ git format-patch HEAD^^^ #生成最近的3次commit的patch$ git format-patch HEAD^^^^ #生成最近的4次commit的patch$ git format-patch … #生成两个commit间的修改的patch包含两个commit. 和都是具体的commit号)$ git format-patch -1 #生成单个commit的patch$ git format-patch #生成某commit以来的修改patch不包含该commit$ git format-patch --root #生成从根到r1提交的所有patchgit am:$ git apply --stat 0001-limit-log-function.patch # 查看patch的情况$ git apply --check 0001-limit-log-function.patch # 检查patch是否能够打上如果没有任何输出则说明无冲突可以打上(注git apply是另外一种打patch的命令其与git am的区别是git apply并不会将commit message等打上去打完patch后需要重新git add和git commit而git am会直接将patch的所有信息打上去而且不用重新git add和git commit,author也是patch的author而不是打patch的人)$ git am 0001-limit-log-function.patch # 将名字为0001-limit-log-function.patch的patch打上$ git am --signoff 0001-limit-log-function.patch # 添加-s或者–signoff还可以把自己的名字添加为signed off by信息作用是注明打patch的人是谁因为有时打patch的人并不是patch的作者$ git am ~/patch-set/.patch # 将路径~/patch-set/.patch 按照先后顺序打上$ git am --abort # 当git am失败时用以将已经在am过程中打上的patch废弃掉(比如有三个patch打到第三个patch时有冲突那么这条命令会把打上的前两个patch丢弃掉返回没有打patch的状态)$ git am --resolved #当git am失败解决完冲突后这条命令会接着打patch参看修改的文件$ git show --stat [commit id]切换远程分支git checkout -b 本地分支名 origin/远程分支名$git branch -a$git checkout -b release/v8.3 remotes/origin/release/v8.3Git报错解决OpenSSL SSL_read: Connection was reset, errno 10054$ git config --global http.sslVerify false$ git config --global https.sslVerify falseGit查看配置列表信息git config --listgit config --global --listGit 配置和删除配置添加配置git config --global 配置名 参数值git config --global user.name “你的用户名”git config --global user.email “你的邮箱”删除配置值git config --global --unset 配置名Git版本代码拷贝后所有文件每行都多个^M使用 Git 进行版本控制时有时会遇到文件每行结尾有 ^M 字符的情况。通常出现在 Windows 操作系统中并且会影响文件在不同操作系统之间的可移植性。^M 字符是回车符的表示在 Windows 操作系统中每个文本行的结尾都是由回车符 (\r) 和换行符 (\n) 组成的而在类 Unix 系统中只使用换行符 (\n)。使用 Git 提供的 core.autocrlf 选项来自动地处理回车符。可以使用以下命令来设置 core.autocrlf 选项在 Windows 系统中将回车符转换为换行符提交到 Git 仓库在检出时自动转换回来即恢复为回车符。$ git config --global core.autocrlf true在 Linux 或 macOS 系统中提交时不会将回车符转换为换行符在检出时也不会进行转换。$ git config --global core.autocrlf input提交不了可以设置如下参数$ git config core.safecrlf false权限缓存输入一次正确的账号密码之后的git操作就不用每次输入账号密码了$ git config --global credential.helper storeerror: RPC failed; curl 18 transfer closed with outstanding read data remainingerror: RPC failed;curl18transfer closed with outstandingreaddata remaining fatal: the remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed$ git config --global http.postbuffer1048576000$ git config --global http.lowspeedlimit0$ git config --global http.lowspeedtime999999git 提交部分修改文件有时候我们修改了多个功能模块的代码需要单独提交功能模块代码修改时可以按照如下步骤操作git status -s #查看当前仓库状态git add src/modules/xxx.c #添加需要提交的文件git stash -u -k #忽略其他文件此时再git status会发现未被add的文件以被隐藏git commit -m “提交描述…”git pull # 拉取合并如果有远程仓库需要先同步合并git push # 推送到远程仓库如果有远程仓库git stash pop # 恢复隐藏忽略的文件这一步非常重要git status # 此时之前被隐藏的改动文件恢复显示。

相关新闻

Fine-tuning彻底讲透:从零基础到实战微调,为什么说Fine-tuning是AI开发者必须跨越的分水岭?
2026/7/9 14:01:15

Fine-tuning彻底讲透:从零基础到实战微调,为什么说Fine-tuning是AI开发者必须跨越的分水岭?

你有没有过这种体验:辛辛苦苦写了一整套Prompt,大模型还是答非所问?让它写代码,明明说了"用React Hooks风格",它还是给你生成Class组件;让它翻译专业文档,明明要的是"法律英语&q…

阅读更多
PIC18F45K50与PAM8904构建低功耗多事件警报系统
2026/7/9 14:01:15

PIC18F45K50与PAM8904构建低功耗多事件警报系统

1. 项目背景与硬件选型解析在工业控制、智能家居和安防系统中,可靠的通知和警报功能是保障系统安全运行的关键环节。传统的蜂鸣器驱动方案往往存在功耗高、音质差、功能单一等问题。本项目基于PIC18F45K50微控制器和PAM8904高效音频放大器构建了一套灵活可配置的多事…

阅读更多
从光储充到氢动力:2026武汉新能源汽车产业博览会定档,见证全产业链数智飞跃
2026/7/9 14:01:15

从光储充到氢动力:2026武汉新能源汽车产业博览会定档,见证全产业链数智飞跃

能源重塑出行!2026武汉新能源汽车产业博览会,开启绿色交通新极点从光储充到氢动力:2026武汉新能源汽车产业博览会定档,见证全产业链数智飞跃定档九省通衢!2026武汉充换电大会来袭,看智能网联如何定义未来车…

阅读更多
魔兽世界终极宏编辑器指南:GSE高级宏编译器完全教程
2026/7/9 16:01:16

魔兽世界终极宏编辑器指南:GSE高级宏编译器完全教程

魔兽世界终极宏编辑器指南:GSE高级宏编译器完全教程 【免费下载链接】GSE-Advanced-Macro-Compiler GSE is an alternative advanced macro editor and engine for World of Warcraft. 项目地址: https://gitcode.com/gh_mirrors/gs/GSE-Advanced-Macro-Compiler…

阅读更多
Excel 与 SPSS 正态性检验对比:箱线图、直方图、Q-Q图 3种方法优劣解析
2026/7/9 16:01:16

Excel 与 SPSS 正态性检验对比:箱线图、直方图、Q-Q图 3种方法优劣解析

Excel与SPSS正态性检验全攻略:箱线图、直方图与Q-Q图的深度对比1. 正态性检验的核心价值与工具选择当我们面对一组数据时,第一件事往往是了解它的分布特征。正态分布(又称高斯分布)作为统计学中最重要的一种概率分布,其…

阅读更多
3D动画师的救星:UniRig如何让复杂骨骼绑定变得像喝水一样简单?
2026/7/9 16:01:16

3D动画师的救星:UniRig如何让复杂骨骼绑定变得像喝水一样简单?

3D动画师的救星:UniRig如何让复杂骨骼绑定变得像喝水一样简单? 【免费下载链接】UniRig [SIGGRAPH 2025] One Model to Rig Them All: Diverse Skeleton Rigging with UniRig 项目地址: https://gitcode.com/gh_mirrors/un/UniRig 你是否曾经面对…

阅读更多
创世战车甜心定位与实战指南:中距离支援与模块破坏
2026/7/9 16:01:16

创世战车甜心定位与实战指南:中距离支援与模块破坏

🚀 30款热门AI模型一站整合,DeepSeek/GLM/Qwen 随心用,限时 5 折。 👉 点击领海量免费额度 1. 先搞清楚“甜心”在创世战车里到底是个什么定位 “甜心”不是那种能让你开局就冲进敌阵乱杀的战车类型。如果你指望它像重坦一样扛…

阅读更多
STM32L021K4与MCP3428的高精度低功耗数据采集方案
2026/7/9 16:01:16

STM32L021K4与MCP3428的高精度低功耗数据采集方案

1. MCP3428与STM32L021K4的硬件组合解析在嵌入式数据采集系统中,ADC(模数转换器)的性能往往决定了整个系统的精度上限。MCP3428作为Microchip推出的18位Δ-Σ型ADC芯片,其核心优势在于将高分辨率与低噪声特性集成在了TSSOP-10的小…

阅读更多
AI 赋能服饰赛道,天丝阔腿裤爆款文案该怎么造?
2026/7/9 15:01:16

AI 赋能服饰赛道,天丝阔腿裤爆款文案该怎么造?

深耕 AI 产业落地的北京先智先行科技有限公司,目前拥有三款标杆级旗舰产品,分别是具备私有化部署能力的先知大模型、面向从业者教学赋能的先行 AI 商学院、一站式内容生产载体先知 AIGC 超级工场,全方位覆盖企业数字化内容创作全链路需求。该…

阅读更多
通达OA SQL注入漏洞深度剖析:从手工注入到自动化利用与防御
2026/7/8 4:53:25

通达OA SQL注入漏洞深度剖析:从手工注入到自动化利用与防御

1. 项目概述与漏洞背景最近在梳理一些历史OA系统的安全风险时,通达OA v11.6版本中的一个老漏洞又进入了我的视线。这个漏洞位于/general/bi_design/appcenter/report_bi.func.php文件中,是一个典型的SQL注入点。虽然这个漏洞的利用方式看起来并不复杂&am…

阅读更多
3步彻底解决Windows右键菜单混乱问题:ContextMenuManager使用全攻略
2026/7/9 0:51:16

3步彻底解决Windows右键菜单混乱问题:ContextMenuManager使用全攻略

3步彻底解决Windows右键菜单混乱问题:ContextMenuManager使用全攻略 【免费下载链接】ContextMenuManager 🖱️ 纯粹的Windows右键菜单管理程序 项目地址: https://gitcode.com/gh_mirrors/co/ContextMenuManager 你是否曾为Windows右键菜单中那些…

阅读更多
GXDE OS下Wayland兼容性实战:从deepin-mutter原理到VMware Tools修复
2026/7/8 22:48:04

GXDE OS下Wayland兼容性实战:从deepin-mutter原理到VMware Tools修复

如果你正在用 GXDE OS 或者任何基于 Deepin 的发行版,并且遇到了“检测到窗口系统采用 Wayland 协议,程序即将退出”这类弹窗,或者发现 VMware Tools 在 Ubuntu 24.04 这类默认 Wayland 的系统上启动失败,那这篇文章就是为你准备的…

阅读更多
Unity WebGL部署Apache Tomcat:MIME配置、Gzip压缩与缓存优化实战
2026/7/9 0:01:12

Unity WebGL部署Apache Tomcat:MIME配置、Gzip压缩与缓存优化实战

1. 项目概述:当Unity WebGL遇上Apache Tomcat如果你是一名Unity开发者,想把精心制作的WebGL游戏或应用部署到自己的服务器上,那么Apache Tomcat大概率是你绕不开的一环。这不仅仅是把一堆构建出来的文件扔进一个文件夹那么简单。我见过太多项…

阅读更多
掌握Docker多阶段构建镜像优化技巧
2026/7/9 0:01:12

掌握Docker多阶段构建镜像优化技巧

掌握Docker多阶段构建镜像优化技巧在容器化技术日益普及的今天,Docker已成为开发与运维领域的基石工具。然而,随着应用复杂度提升,构建出的Docker镜像体积庞大、层数繁多、安全性欠佳等问题逐渐凸显,直接影响着部署效率、传输速度…

阅读更多
Ansible的AWX与作业模板调度
2026/7/9 0:01:12

Ansible的AWX与作业模板调度

在当今快速迭代的IT运维与开发领域,自动化已成为提升效率、保障一致性的核心支柱。Ansible作为一款强大的IT自动化工具,以其无代理、简单易用的特点广受欢迎。而AWX,作为Ansible上游项目提供的企业级Web界面、API及任务引擎,则将A…

阅读更多
基于Dify与DeepSeek构建私有知识库问答系统实战指南
2026/7/8 18:15:39

基于Dify与DeepSeek构建私有知识库问答系统实战指南

在业务中快速构建一个能理解私有文档、准确回答专业问题的智能助手,是很多开发团队面临的共同挑战。传统方案往往需要从零开始搭建复杂的 RAG(检索增强生成)系统,涉及文档解析、向量化、检索、大模型调用等多个环节,整…

阅读更多
FAE放射组学分析工具:医学影像特征探索的完整解决方案
2026/7/8 10:11:21

FAE放射组学分析工具:医学影像特征探索的完整解决方案

FAE放射组学分析工具:医学影像特征探索的完整解决方案 【免费下载链接】FAE FeAture Explorer 项目地址: https://gitcode.com/gh_mirrors/fae/FAE 你是否曾经面对海量医学影像数据感到无从下手?想要从CT、MRI等影像中提取有价值的定量特征&#…

阅读更多
DesktopNaotu:你的终极离线思维导图解决方案,告别网络依赖!
2026/7/9 3:17:42

DesktopNaotu:你的终极离线思维导图解决方案,告别网络依赖!

DesktopNaotu:你的终极离线思维导图解决方案,告别网络依赖! 【免费下载链接】DesktopNaotu 桌面版脑图 (百度脑图离线版,思维导图) 跨平台支持 Windows/Linux/Mac OS. (A cross-platform multilingual Mind Map Tool) 项目地址:…

阅读更多