git config remote.gerrit.url ssh://192.168.1.101:29418/bsp/hardware/intel/libcamera.git //repo 里新加的工程,新添加libcamera工程。
git config remote.gerrit.push HEAD:refs/for/honeycomb/project //push 整个工程目录到project中。
git config remote.gerrit.receivepack "git receive-pack --reviewer xxx@xxx.com --reviewer xxxx@xxxx.com --reviewer xxxxx@xxxxx.com --reviewer xxxxxxx@xxxxxxx.com" //给人review, xxx@xxx.com就是reviewer的邮箱。
git push gerrit HEAD:refs/heads/honeycomb/ada6 //直接提交到gerrit上,省略给人review。
git push gerrit //提交到gerrit上
如果review完了,patch需要修改:
修改***.c文件,提交如下:
git add ***.c //修改***.c后,再把***.c提交上去
git commit --amend //修改commit message
git push gerrit //把修改的东西,push到gerrit上。
有些文件,如xx.bin文件,会被.gitignore 忽略掉,需要
git add xx.bin -f //这样就能把忽略掉的文件给添加上
这样就修改结束,提交完成了。
git fetch ssh://xxha@192.168.1.101:29418/aosp/platform/bionic refs/changes/22/322/5 && git checkout FETCH_HEAD //从gerrit上取头一个patch。
git cheery-pick FETCH_HEAD //把头个patch提交上去。
ChangID 一样, 就可以提交到一个gerrit上,可以通过修改ChangeID 来提到同一个gerrit上。
git clone git@192.168.1.1:dir.git 可以把整个工程 clone下来。
git pull --all //到project中,运行,得到最新的patch。
git add .
git log -p include/camera/CameraParameters.h //查看git工程下,某个文件的git log。
git reset HEAD code //change green status to red status.
git config --global user.email "XXXX.XX@XXXX.com" //change to your email, same format
git config --global apply.whitespace fix //打别人的 patch 时 自动 fix whitespace 问题
git am -3 0001--xxxx.patch //硬把patch打上,会合并出错误 >>>> <<<<符号。修改之后,可以使用
git add file.name
git am -3 --continue //把patch完整打完。
1.先到相应的git分支目录:
2.git format-patch -1 //生成patch
3.git commit -a -m"Bug B1048, Widget of FileManager" //commit code,上传代码。
4.查看状态
xxha@xxha-OptiPlex-780:~/work/kunlun0111/packages/wallpapers/Basic$ git status -- src/com/android/wallpaper/polarclock //查看目录下文件情况,这里是删了2个文件。
# Not currently on any branch.
# Changed but not updated:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: src/com/android/wallpaper/polarclock/PolarClockSettings.java
# deleted: src/com/android/wallpaper/polarclock/PolarClockWallpaper.java
#
no changes added to commit (use "git add" and/or "git commit -a")
5. checkout 文件,重新下载文件
git checkout -- src/com/android/wallpaper/polarclock/PolarClockWallpaper.java
6. 打.patch 补丁
patch -Np1 -i xxxx.patch
试打patch:
patch --dry-run -p1 xxxx.patch //切到当前目录打用p1。