Chinaunix首页 | 论坛 | 博客
  • 博客访问: 28776
  • 博文数量: 10
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 103
  • 用 户 组: 普通用户
  • 注册时间: 2013-03-31 22:25
文章分类

全部博文(10)

文章存档

2013年(10)

我的朋友

分类: 服务器与存储

2013-04-21 12:39:23

1. Get code

git clone ssh://username@gerrit_server:29418/kernel_goldfish

git clone ssh://fenggxin@10.126.39.248:29418/kernel_goldfish

2. push code

git push ssh://gerrit_server:29418/kernel_goldfish HEAD:refs/for/branch_name

git push ssh://10.126.39.248:29418/kernel_goldfish HEAD:refs/for/android-goldfish-2.6.29

3.  Change-ID

http://gerrit.googlecode.com/svn/documentation/2.0/user-changeid.html


$ scp -p -P 29418 review.example.com:hooks/commit-msg .git/hooks/
$ scp -p -P 29418 10.126.39.129:hooks/commit-msg .git/hooks/



Change-ID is very useful when push task.

If you push one task already, this task is not reviewed and submitted in gerrit server. Now, you find some error and want to do some change for it. Now, you can do like this,

  • modify your code
  • git commit -a --amend
  • git push ssh://10.126.39.129:29418/kernel_goldfish HEAD:refs/for/android-goldfish-2.6.29git push


Please see this picture, in this one task, there will be 2 Patches for it.  Patch set 1 and Patch set 2. So, you don't have to submit another task for it.

4. revert change

If the changes was reviewed and submitted by someone, in sequence, the project owner revert it. Now, you need to do,

git checkout the previous branch before you reverted changes. create a new branch for it, you can work on new branch.

  • $git checkout branchname -b newbranch
  • $git pull
  • $git log      #you can find the logs that change was reverted.
  • $ git fetch refs/changes/02/2/1 && git format-patch -1 --stdout FETCH_HEAD > chard.patch     #get your change content from gerrite, you can find the up command line from gerrit web page.
  • $ patch -p1 < drivers/chard.patch
  • Now, modify your content, and add/commit/push it again.

5.  Generate patch

$cd 

$git log

commit e2a6df4f87e1da14bafcc3bfd0225bedefb00f63
Author: fengxinfeng
Date:   Wed Jul 11 16:36:16 2012 +0800

    Add my driver chard module.
    
    Change-Id: I6956feeeda3e71c5d1986e04a5bf08d1f3899cf8
    Signed-off-by: fengxinfeng

commit 5424d42a37a3edd8f18a3f9e7212821adfe7bfe0
Merge: 6ef62c1 b487065
Author: Xinfeng Feng
Date:   Wed Jul 11 15:49:08 2012 +0800

    Merge "Revert "Add my character driver module, and modify arch/x86/configs/vbox/defconfig add CONFIG_CHARDRIVER=y  CONFIG_CHARD_TEST=m Si

commit 6ef62c11bd4750a5aa4d7d1b1d3d28aec34b4109
Author: Xinfeng Feng
Date:   Wed Jul 11 15:48:17 2012 +0800

    Revert "modify arch/x86/configs/vbox_defconfig Signed-off-by: fengxinfeng "
    
    This reverts commit 0e8988d7d04895001a872cc2cbaf283aa04d90e3


 $git format-patch HEAD^

will generate patch file, difference between  e2a6df4f87e1da14bafcc3bfd0225bedefb00f63 andI6956feeeda3e71c5d1986e04a5bf08d1f3899cf8

$git format-patch HEAD^^

6. Check if your code follow the coding Style

After push your code,

$git format-patch HEAD^

will generate patchfile, 0001-*-*.patch

$./scripts/checkpatch.pl 0001-Add-my-driver-chard-module.patch

will display the style errors, like this,

WARNING: line over 80 characters
#336: FILE: drivers/chard/chardev.c:257:
+        printk(KERN_INFO "mknod %s c %d 0\n", DEVICE_FILE_NAME, MAJOR_NUM);

WARNING: line over 80 characters
#512: FILE: drivers/chard/test.c:71:
+            printf("ioctl_get_nth_byte failed at the %d'th byte:\n", i);

total: 0 errors, 9 warnings, 484 lines checked

0001-Add-my-driver-chard-module.patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see


Q&A


Q 1. 
remote: ERROR:  In commit cf9ef53e6326502d10c621cbfff1ad8caabfc67f
remote: ERROR:  committer email address xinfeng.feng@tieto.com
remote: ERROR:  does not match your user account.
remote: ERROR:
remote: ERROR:  The following addresses are currently registered:
remote: ERROR:    Xinfeng.Feng@tieto.com
remote: ERROR:
remote: ERROR:  To register an email address, please visit:
remote: ERROR:  remote: 
remote:


solution:

Change golbal configuration

Edit ~/.gitconfig

[user]
    name = fengxinfeng
    email = Xinfeng.Feng@tieto.com

change the last commit

$git commit --amend --author 'fengxinfeng '


Q2.

[remote rejected] HEAD -> refs/for/android-goldfish-2.6.29 (not Signed-off-by author/committer/uploader)

$git commit --amend --s

Add Signed-off-by line by the committer at the end of the commit log message.

阅读(2451) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~