Showing posts with label github. Show all posts
Showing posts with label github. Show all posts

Thursday, March 21, 2019

在Pull requests上添加commits

自己的Pull requests, 在Pull requests后, 如何再次添加commits上去

Pull requests是绑定你Pull requests的那个分支的, 所以说只要你push commits到你Pull requests上的那个分支就可以了
比如, 你在分支patch-1上修改了内容, 然后Pull requests到别人的仓库, 接下来, 你想继续修改, 直接commits到patch-1这个分支即可

如何添加commits到别人的Pull requests上

只要Contributor没有取选Allow edits from maintainers就可以修改, 一般情况没人会取选

第一种方式: 通过网页来修改

非常简单, 点进commit里去, 右上角有个像笔一样的图标直接点进去修改提交即可

第二种方式: 通过命令行来修改

这个问题我一直想解决, Google了很多, 都没有发现有详细解决的
首先明确一点, 如果说Contributor没有取选Allow edits from maintainers, 那么默认maintainers 就可以修改Pull requests绑定的那一个分支
这样的话, 直接提交到那个分支即可
这里写下自己的命令, 使用了hub, 比用git省很多事, 不用复制用户名, 分支名啥的

1
2
3
4
hub pr list        # 列出PR
hub pr checkout xx # 要切换到的PR
xxx                # 这里修改然后commit
hub push           # push
这样就可以了