开发环境 - git、repo工具使用

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Ivan804638781/article/details/80664089

采用git工具,代码上传流程记录

很多操作还不确定具体意义,仅自己参考

通过repo下载代码:

    1.首先使用repo地址,初始化repo目录

repo init -u 172.16.8.9:manifest/sysdevrepo.git -b xxx

    2.再下载所有代码

repo sync

    3.整体切换分支

repo start --all sysdev_v2.x

通过git下载代码:

git clone ssh://[email protected]:29418/sysdev/packages/linux_lsp/kernel/klsp.git

    1.查看git分支

        git branch -r

    2.切换git分支

        git checkout xx/xx

查看某一分支的修改情况:

git show 版本号    //查看具体版本号的详细修改

可以丢弃工作区的修改:

git checkout -- file

git上传流程

1.查看当前分支状态,查看哪些文件被修改过

git status

2.查看当前处于git的哪个分支上

git branch -a

3.确定分支后,从远端拉代码

git checkout -b sysdev_kdv_v1.x origin/sysdev_kdv_v1.x

4.再次查看当前分支(如果分支不对,使用git checkout <local_branch> #切换本地分支 )

git branch

5.清除之前编译生成的没用的文件

make distclean

6.再次查看当前分支状态

git status

6.5 先将本地代码压栈,存储起来

git stash

7.将当前修改的部分搭一个备份,同时将远端代码更新到本地(保存备份)

git pull --rebase 

8.将备份和远端代码作比较,查看哪些文件是否发生冲突

git stash pop 

9.查看分支、添加git、查看状态

git branch
git add .
git status

10.添加标签git commit -s(此时需要在redmine上创建任务,需要有任务id)

Redmine#660907 hdu5:3536 fix i2c transfer issue
 详细描述...
...

11.可能会提交出错,原因是代码中有多余空格,查看出错部分(EOF提示表示后面多了一个空行)

 
git log
git show c144539b93f5c2ab676940905172e70603ff8c76 --oneline --check 

12.改完了之后,重新提交
 

git add .
git commit --amend

13.最后一步推送至远端

codereview

git错误处理:

1.提示错误如下:

remote: ERROR: missing Change-Id in commit message footer

解决办法:http://www.360doc.com/content/17/0615/18/10058718_663429286.shtml

2.空格错误

whitespace error!check your code please~

系统部代码提交到gerrit审核前,增加whitespace error检查

  错误提示为:whitespace error!check your code please~

  当显示上述错误时,将文件退回未跟踪状态($ git reset HEAD^ ),删除whitespace后重新提交

  自查方法

  1:代码未收控状态下,通过 git diff --check,查找是否存在错误

  2:提交到本地仓库后,通过 git show commit-id --oneline --check,查找是否存在错误 (其中commit-id通过git log查看)

猜你喜欢

转载自blog.csdn.net/Ivan804638781/article/details/80664089