将github包的特定提交合并到我的项目中使用的github包中

时间:2018-07-10 00:31:17

标签: git github

我想使用this tslint commit。我不认为这是合并到掌握。

我尝试将 package.json <TextView android:id="@+id/txtViewWeb" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Web: www.pareshnmayani.wordpress.com" android:autoLink="web" android:textSize="16sp" android:layout_margin="5dip"> </TextView> 编辑为:

devDependencies

它没有用,但是它也不再包含新的tslint功能,因为它是旧的提交,所以我认为这不是一个好的解决方案。

如何将提交提交到我的tslint版本中?

1 个答案:

答案 0 :(得分:0)

您可以考虑将一项提交挑选到您自己的存储库中,并在package.json中引用新的HEAD SHA1。

git cherry-pick允许您将提交的更改应用于代码。

由于您不拥有github.com/palantir/tslint,因此需要fork it,在本地克隆该fork,然后

cd /path/to/my/local/clone
git remote add upstream https://github.com/palantir/tslint
git config --add remote.upstream.fetch "+refs/pull/*/head:refs/remotes/upstream/pr/*"
git fetch upstream
git checkout master

现在,您实际上可以合并pr('pull-request')分支,而不用挑选一个或几个提交:

git checkout pr/1060
git checkout master
git merge pr/1060
git push

现在您可以引用刚刚创建并推送的合并提交。