repo

repo使用技巧

1.如何使用repo下载特定repo?

>> 1.cd .repo/manifests/

  2.grep "name=" -nr

  2.sync --foce-sync $(repo_name)

2.repo sync

repo sync目的是将你的本地仓库和远程仓库同步,包含从远程仓库获取最新的更改、更新本地的追踪分支、并尝试合并这些更改到你当前的分支。

1.‘repo sync'会对所有仓库执行‘git fetch’,会从远程仓库获取最新的提交和分支.

2.'rpeo sync'会尝试将远程分支的更改合并到你当前的分支,如当前分支可以快进(即没有冲突或本地未推送的提交),通常自动更新。

3.重置本地分支,如果你使用‘repo sync -d’ (-d = --detach), 他会将所有项目重置到manifest文件中指定的修订版本,即使这会放弃本地的更改。

 

3.使用repo sync清除本地修改

# 清除所有未暂存的更改
repo forall -c 'git reset --hard'

# 清除所有未跟踪的文件和目录
repo forall -c 'git clean -fdx'

# 重置所有本地提交到远端分支的状态
repo forall -c 'git reset --hard @{u}'

4.repo list
列出所有git仓库中每个project name和路径
posted @ 2022-08-25 17:15  老胡同学  阅读(29)  评论(0编辑  收藏  举报