开源社区协同技能01-git pull request以及之后
0. 目标
- 向怼圈公开仓库投稿
- 确认投稿成功并发布
- 料理pull request之后事
1. 资源
- SO | git - How to do a GitHub pull request - Stack Overflow
- 官档 | About pull requests - User Documentation
- 官档 | Creating a pull request - User Documentation
- 官档 | Creating a pull request from a fork - User Documentation
- 官档 | How to write the perfect pull request | The GitHub Blog
- SO | How do I delete a Git branch both locally and remotely? - Stack Overflow
- card | Git: Delete a branch (local or remote) - makandra dev
- 官档 | Fetching a remote - User Documentation
- 阮一峰 | Git远程操作详解 - 阮一峰的网络日志
- SO | github - How can I switch to another branch in git? - Stack Overflow
2. 要点
- fork他人仓库到自己的github中来
- git clone刚刚fork的仓库到自己本地电脑中来
- 在自己本地电脑做修改
- 这里注意将修改建立在新的分支上,最好不要在master分支上进行修改
- 确保master分支只保存finished and approved work
- git add, git commit, git push到自己的github上
git push <远程主机名> <本地分支名>:<远程分支名>
- 点击
pull request
请求- 见下图,从fork仓库的特殊分支(红色)推送到原仓库的master分支(蓝色)
- 书写此次pull request的简要说明
- 进入slack gh频道确认pull request成功
- 删除本地特殊分支
- 取回远程库更新到本地master分支
- git pull <远程主机名> <远程分支名>:<本地分支名>
- git pull origin master:master
- 重新开始第2次pull request
3. 命令行
git clone git@hostname.com:<githubid>/<repo>.git
//git clone远程仓库git branch
//查看本地目前所在分支git checkout -b <branch-name>
//本地新建分支git push origin <branch-name>:master
//将本地特殊分支的修改推送至远程库master分支git checkout <branch-name>
//跳转到本地已存在的branchgit branch -d the_local_branch
//删除本地已被fully merged in its upstream branch的特殊分支git pull origin master:master
//取回origin主机的master分支,与本地的master分支合并
changelog
18-08-03 发布个人博客
18-07-27 增补pull request之后
18-07-23 init