2 回答
TA貢獻(xiàn)1852條經(jīng)驗 獲得超1個贊
1. Fork別人的代碼repo
2. clone自己的fork到本地,進(jìn)行修改
在自己的Repositories里面找到剛才fork出來的Repo.
因為畢竟不是原作者,要定期去update最新的代碼,所以最好不要直接提交到自己的master branch上,而是在github上單獨創(chuàng)建一個branch。
然后在右側(cè)找到SSH clone URL,在本地的命令行里面執(zhí)行
PS:
也可以直接在github上修改,然后頁面內(nèi)Commit。量不大時,這樣做比較方便。只要網(wǎng)速給力……
3. 提交修改到github
[python] view plain copy print?
git commit -a
git push
4. 創(chuàng)建pull request 讓作者codereview
點擊Pull Requests -> New pull request
點擊Edit
左側(cè)選取作者的master branch (一般是這樣,除非有單獨的branch給開發(fā)用),右側(cè)選自己的repo的新branch
再點擊 Click to create a pull request for this comparison 填入信息提交就OKl了。
5. Update 作者最新的代碼
同樣在自己的repo里面,新建一個pull request,左側(cè)是自己的,右側(cè)是原作者的branch,創(chuàng)建后提交就OK了。
6. rollback repository到某個commit
github上有時我們想rollback某個branch到某個commit,直接在本地執(zhí)行
[python] view plain copy print?
git checkout <target_branch>
git reset --hard <commit_id>
git push -f
- 2 回答
- 0 關(guān)注
- 770 瀏覽
添加回答
舉報
