Need advice: Handling GitHub PRs with import rewriting

blov · · 433 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Let me preface this by stating that I&#39;m a complete noob when it comes to using git.</p> <p>I have a repo that I worked on GitHub and then cloned on my PC. The project has many packages and most of them import some package from somewhere else in the tree. I rewrote the imports to reference my own namespace.</p> <p>Now that I&#39;m done testing my changes, I&#39;m ready to push back to GH and submit a pull request, but I&#39;d have to rewrite all those imports back to the way they were. This seems very cumbersome and I&#39;m wondering if there&#39;s a better way to do it.</p> <hr/>**评论:**<br/><br/>dgryski: <pre><p>Follow the instructions at <a href="https://splice.com/blog/contributing-open-source-git-repositories-go/">https://splice.com/blog/contributing-open-source-git-repositories-go/</a> or <a href="http://blog.campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html">http://blog.campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html</a></p></pre>mrfrobozz: <pre><p>Excellent! Thank you. That cleared it all up for me.</p></pre>peterbourgon: <pre><p>Don&#39;t rewrite imports, use git remotes to work with your fork in the original repo&#39;s path on disk.</p> <pre><code>cd src/github.com/original/project git remote add mrfrobozz git@github.com:mrfrobozz/project git fetch mrfrobozz git checkout mrfrobozz master </code></pre></pre>mrfrobozz: <pre><p>Oh that&#39;s interesting. And a bit backwards from how the GitHub docs walked me through it, but it makes a lot of sense. Then when I push, I&#39;d do a </p> <pre><code>git push mrfrobozz master </code></pre> <p>Right?</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

433 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传