2021年1月7日 星期四

git repo 管理

 git repo 管理





有一個使用情形是用 repo管理

 

已經出一版 1.0 sdk了。


如果是有patch的話想只出1.01有修改的檔案

如  project a 的 ddd.c  和 project b的 eee.c

 

是不是有對應的指令可以做到


repo forall -c 'git diff --src-prefix=old/$REPO_PATH/ --dst-prefix=new/$REPO_PATH/ v1.0 v1.0.1' > all.patch


This command generates a single patch for the change from v1.0 to v1.0.1 tags.




將有修改後的檔案 tar起來。


single tar file::  files the change from v1.0 to v1.0.1 tags.



List file different to `filelist`

$ repo forall -c 'git diff HEAD v1.0.1 v1.0 --name-only | sed -e "s|^|$REPO_PATH/|"' > filelist


Create tarball according to `filelist`

$ tar jcvf test.tar.bz2 `cat filelist`





https://stackoverflow.com/questions/33030289/is-there-a-tool-to-create-repo-manifest-file-with-sha-based-on-current-work-dire




The repo manifest command creates manifest files with fixed SHA-1s based on the current workspace.


repo manifest -r -o my-manifest.xml







只用git管理的情形

http://stackoverflow.com/questions/12841360/git-archive-from-changed-files-on-bare-repos

 


git archive --format=tar --prefix='/' master `git diff V1.02 master --name-only` | gzip -9 > ~/tars/update-v1.02-`git describe master --tags`.tar.gz



https://www.jianshu.com/p/58e5d4f9f9a9


https://source.android.com/setup/develop/repo



大丈夫日記 

http://ryan0210.blogspot.com/2013/10/coding-repo-git.html


泰勞筆記

https://thai-lin.blogspot.com/2017/05/repo-git.html




repo sync -j threadcount



 -j threadcount :在線程之間拆分同步,以加快完成速度。確保不要通過為其他任務保留一些CPU來壓倒計算機。要查看可用CPU的數量,請首先運行: nproc --all

 



git push origin master 


1.

直接 push:

$ git push orgin default:master


2.


進到 code review的push 指令

git push origin default:refs/for/master


PS. 其實 repo upload 指令,就是把 topic branch push 到 refs/for/project-branch,

       就會直接進到 code-review 頁面上



tig


m main view

d diff view

r branch view the branches, remotes and tags in the repository.

t tree view

b blame view Displays the file content annotated or blamed by commits.


all view

j k up/down

J K next/previous

上鍵 下鍵 next/previous

page up/down : page up down

q 關閉 畫面


in main view

D 切換 date display modes

A 切換 author display modes

X 切換 commit sha

enter  查看 commit 的詳細 diff 變更 

q 關閉 diff 畫面。


還有 tig 指令後面接 branch 名稱可以直接查看分支,接著在分支 commit 上按大寫 C 可以 cherry-pick 回目前的 branch,而 tig 後面接檔名的話可以直接查看跟這個檔案有關的 commit,更多的基本功能介紹可以看 git? tig! 這篇文章。



https://devhints.io/tig

http://blog.kidwm.net/388

http://jonas.nitro.dk/tig/manual.html


沒有留言:

張貼留言