当前位置:   article > 正文

Github上fork项目后与源项目同步_idea fork 项目链接源项目

idea fork 项目链接源项目

先上一个流程图

这里写图片描述

  1. 首先是fork一个项目到自己的Github上
  2. 把自己Github上的代码clone到本地
git clone https://github.com/wxxiong6/phpstorm-stubs.git
  • 1

查看远程版本

git remote -v
  • 1

结果

origin  https://github.com/wxxiong6/phpstorm-stubs.git (fetch)
origin  https://github.com/wxxiong6/phpstorm-stubs.git (push)
  • 1
  • 2

只能看到自己Github

  1. 添加源项目远程master git remote add phpstorm
    这个phpstorm 是自己取的名字
git remote add phpstorm https://github.com/JetBrains/phpstorm-stubs.git
  • 1
  • 2

再次查看

git remote -v
  • 1

结果

origin  https://github.com/wxxiong6/phpstorm-stubs.git (fetch)
origin  https://github.com/wxxiong6/phpstorm-stubs.git (push)
phpstorm    https://github.com/JetBrains/phpstorm-stubs.git (fetch)
phpstorm    https://github.com/JetBrains/phpstorm-stubs.git (push)
  • 1
  • 2
  • 3
  • 4
  1. 获取源项目远程的代码
git fetch phpstorm
  • 1

结果

remote: Counting objects: 595, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 595 (delta 241), reused 244 (delta 241), pack-reused 350
Receiving objects: 100% (595/595), 206.25 KiB | 147.00 KiB/s, done.
Resolving deltas: 100% (301/301), completed with 65 local objects.
From https://github.com/JetBrains/phpstorm-stubs
 * [new branch]      master     -> phpstorm/master
 * [new tag]         2018.1.2   -> 2018.1.2
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

查看分支

git branch -av
  • 1

结果

* master                            8005fdd Update yaf_namespace.php
  remotes/origin/HEAD               -> origin/master
  remotes/origin/master             8005fdd Update yaf_namespace.php
  remotes/origin/pr/117             306cc3c introduced first module - standard
  remotes/origin/revert-333-patch-2 0d74e4b Revert "Fix date() $timestamp default value"
  remotes/phpstorm/master           d7f7ad6 Fixed rdkafka extension folder name to be compatible with "Sync Extensions with Interpreter" action
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  1. 合并代码

master

git merge phpstorm/master
  • 1

结果

Updating 8005fdd..d7f7ad6
Fast-forward
 .travis.yml                                                |   19 +
 CONTRIBUTING.md                                            |    4 +
 Core/Core.php                                              |   29 +-
 Core/Core_c.php                                            |   37 +-
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  1. push到自己远程master
git push -u origin master
  • 1

就算完成了

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号