使用git修改R包并推送到远端(Bioconductor)
主要按照Bionconductor中的New package workflow的流程来进行。
- 修改用户名和邮箱
$ git config --global user.name "runoob"
$ git config --global user.email test@runoob.com
如果用了 --global 选项,那么更改的配置文件就是位于你用户主目录下的那个,以后你所有的项目都会默认使用这里配置的用户信息。
如果要在某个特定的项目中使用其他名字或者电邮,只要去掉 --global 选项重新配置即可,新的设定保存在当前项目的 .git/config 文件里。
查看现有的用户名和邮箱:
$ git config --global user.name
$ git config --global user.email
2.查看现有的SSH key, 如果没有,则生成新的SSH key
(1) 查看SSH key
https://github.com/<your-github-id>.keys
(2)如果存在,则添加到github--> Settings--->SSH and GPG keys---> New SSH key
(3)如果不存在,则按照github--> Settings--->SSH and GPG keys---> generating SSH keys中的说明生成SSH key之后再添加
3.将新的SSH key添加到github账号中(步骤如上)和Bioconductor Git Credentials
添加到github账号是为了可以推送改动到github.com
添加到Bioconductor Git Credentials是为了可以推送到git.bioconductor.org
4.配置本地git仓库的远端
查看本地仓库
$ git remote -v
确保origin
指向github.com
, upstream
指向bioconductor.org
,得到类似如下的输出:
origin <link to your github> (fetch)
origin <link to your github> (push)
upstream git@git.bioconductor.org:packages/<YOUR-REPOSITORY-NAME>.git (fetch)
upstream git@git.bioconductor.org:packages/<YOUR-REPOSITORY-NAME>.git (push)
注意:作为软件包开发人员,您必须使用SSH协议(如上述命令中所述)来获得对Bioconductor git存储库中软件包的读/写访问权限。
如果没有名为upstream
的库指向bioconductor.org
,可以通过下面的方式创建:
git remote add upstream git@git.bioconductor.org:packages/<YOUR-REPOSITORY-NAME>.git
5.然后克隆远端bioconductor.org的仓库到本地,然后在本地修改
git clone git@git.bioconductor.org:packages/CAEN.git
将更改添加并提交到本地存储库。在审核过程中,您可能需要更新软件包。 首先要确保您的存储库与github.com和git.bioconductor.org存储库是最新的,然后在本地存储库中执行此操作。
git fetch --all
git merge upstream/master # merge changes from git.bioconductor.org
git merge origin/master # merge changes from github.com
更改包主分支并将其提交到本地存储库(按照流程是这一步,但是如何直到本地仓库的改动被记录?)
按照前面的笔记我是先在本地仓库中初始化一个git repository.
git init
再在本地仓库中修改文件内容,则改动的部分将被记录下来(如何查看更改了哪些文件?)
git status
或者
git commit
按照下面格式,增加修改的文件然后添加注释
git add <files changed>
git commit -m "<informative commit message>"
同样的步骤重复,直到没有标红的文件出现为止
也可以批量处理,步骤如下:
git add --all
git commit -m 'add more files'
git push origin master
6.Bump软件包版本。
软件包版本号格式为“ major.minor.patch”。 审核过程开始时,版本号为“ 0.99.0”。 将patch
版本号增加1,例如,增加到0.99.1
,0.99.2
,...,0.99.9
,0.99.10
,...
在推送之前bumping版本号至关重要。 它确保程序包跨平台构建。
请记住将这些更改添加并提交到本地存储库。
7.将更改推送到Bioconductor和github存储库。 将本地存储库中的更改推送到Bioconductor和github存储库。
git push upstream master # push to git@git.bioconductor.org
git push origin master # push to your github repository
8.检查更新的build报告。