github中fork项目更新方式
来源:互联网 发布:阿里云 幕布申请 编辑:程序博客网 时间:2024/05/26 17:46
在github上看到好的开源项目可以fork成为自己的项目。但是如果fork的项目更新了自己的项目要怎样保持更新呢?
经过一番搜索后找到方法,下面记录下流程。
方法一:登录你的github帐号,选择fork的项目,点击左上角绿色的图标,鼠标放上去以后提示:compare ,review, create a pull reques。
方法二 :将fork后自己的项目clone到本地。
git clone https://github.com/hakits/libpcap.git
$ git remote -voriginhttps://github.com/hakits/libpcap.git (fetch)originhttps://github.com/hakits/libpcap.git (push)将fork之前的项目添加到本地的远程分支中,即作者的分支:
$ git remote add libpcap https://github.com/the-tcpdump-group/libpcap.git$ git remote -vlibpcaphttps://github.com/the-tcpdump-group/libpcap.git (fetch)libpcaphttps://github.com/the-tcpdump-group/libpcap.git (push)originhttps://github.com/hakits/libpcap.git (fetch)originhttps://github.com/hakits/libpcap.git (push)
同步上游仓库到你的仓库需要执行两步:首先你需要从远程拉去,之后你需要合并你希望的分支到你的本地副本分支。
拉取
从远程仓库拉取将取回其分支以及各自的提交。它们将存储在你本地仓库的指定分之下。
$ git fetch libpcap From https://github.com/the-tcpdump-group/libpcap * [new branch] android-libpcap-0.9.8 -> libpcap/android-libpcap-0.9.8 * [new branch] bare -> libpcap/bare * [new branch] lbl -> libpcap/lbl * [new branch] libpcap-1.6 -> libpcap/libpcap-1.6 * [new branch] libpcap-1.7 -> libpcap/libpcap-1.7 * [new branch] libpcap_0_6 -> libpcap/libpcap_0_6 * [new branch] libpcap_0_7 -> libpcap/libpcap_0_7 * [new branch] libpcap_0_8 -> libpcap/libpcap_0_8 * [new branch] libpcap_0_8rel1 -> libpcap/libpcap_0_8rel1 * [new branch] libpcap_0_9 -> libpcap/libpcap_0_9 * [new branch] libpcap_1.1 -> libpcap/libpcap_1.1 * [new branch] libpcap_1.2 -> libpcap/libpcap_1.2 * [new branch] libpcap_1.3 -> libpcap/libpcap_1.3 * [new branch] libpcap_1.4 -> libpcap/libpcap_1.4 * [new branch] libpcap_1.5 -> libpcap/libpcap_1.5 * [new branch] libpcap_1_0 -> libpcap/libpcap_1_0 * [new branch] libpcap_1_0_rel0b -> libpcap/libpcap_1_0_rel0b * [new branch] libpcap_1_4rel0 -> libpcap/libpcap_1_4rel0 * [new branch] linux-2-2-packet -> libpcap/linux-2-2-packet * [new branch] master -> libpcap/master * [new branch] origin -> libpcap/origin
-a 查看所有的分支
-v 查看各个分支最后一个提交对象的信息
$ git branch -av* master 48aacf2 Merge pull request #433 from msekletar/master remotes/libpcap/android-libpcap-0.9.8 91f35ab copy config.h from subdirectory on Android rather than run configure remotes/libpcap/bare feab221 regenerated configure with --with-libnl switch remotes/libpcap/lbl 9de7b67 pcap-0.4 remotes/libpcap/libpcap-1.6 4fec216 Fix previous change. remotes/libpcap/libpcap-1.7 b846943 Fix check for <linux/if_bonding.h>. remotes/libpcap/libpcap_0_6 6c7150d Update the version number. remotes/libpcap/libpcap_0_7 85aac6d Get ready for libpcap 0.7.2 remotes/libpcap/libpcap_0_8 fec98c1 Corrected the definition of IN_EXPERIMENTAL (0xfxxxxxxx is the experimental space) remotes/libpcap/libpcap_0_8rel1 9ad5954 spec file for 0.8
现在我们已经拉取了上游仓库,我们将要合并其变更到我们的本地分支。这将使该分支与上游同步,而不会失去我们的本地更改。
$ git merge libpcap/master Already up-to-date.
$ git push origin master Counting objects: 5, done.Delta compression using up to 4 threads.Compressing objects: 100% (3/3), done.Writing objects: 100% (3/3), 289 bytes, done.Total 3 (delta 2), reused 0 (delta 0)To git@github.com:hakits/libpcap.git 48aacf2..9556d05 master -> master
过一段时间后又需要同步项目了仅需要执行 git fetch libpcap 命令以下的操作即可。
参考:https://help.github.com/articles/syncing-a-fork/
0 0
- github中fork项目更新方式
- github更新fork的项目
- github更新fork之后的项目代码
- GitHub更新自己Fork的项目
- github中更新自己fork的repo
- 同步更新Github中Fork的代码
- GitHub fork更新
- Github之更新fork过来的项目学习笔记
- github fork项目
- Github删除fork项目
- GitHub 更新fork的代码
- github上fork项目后保持与原项目同步更新
- github或者gitlab上fork别人的代码后更新的2种解决方式
- 更新GitHub上自己 Fork 的代码与原作者的项目进度一致
- 更新GitHub上自己 Fork 的代码与原作者的项目进度一致
- github上fork了别人的项目后,再同步更新别人的提交
- github上fork了别人的项目后,再同步更新别人的提交
- 更新GitHub上自己 Fork 的代码与原作者的项目进度一致
- 企业级监控平台开发之nagios二次开发(七)
- JSONObject与JSONArray的使用
- 第59题 Merge Two Sorted Lists
- poj2955 Brackets 简单区间dp
- n的阶乘
- github中fork项目更新方式
- svn总结
- 用Matlab制作图像块颜色提取工具(三)
- Android抓包方法(二) 之Tcpdump命令+Wireshark
- Windows Services的安装部署 三种方法总结
- cmd
- Mac里配置Eclipse + GDB 解决Mac下GDB提示签名错误
- 锤炼"单例"
- [备份] Word中字号与磅值关系