문제

I have a specific commit on a GitHub repository from which I want to extract a patch to apply in a different place, similar what I would get when using git format-patch.

I am lazy or the repository is too big and I don't want to fetch the whole repository just to extract that patch.

How can I do this quickly?

도움이 되었습니까?

해결책

  1. Browse to the appropriate commit, e.g.

    https://github.com/github/gitignore/commit/e9552d855c356b062ed82b83fcaacd230821a6eb

  2. Edit the URL in your address bar and add .diff to the end, e.g.

    https://github.com/github/gitignore/commit/e9552d855c356b062ed82b83fcaacd230821a6eb.diff

  3. Copy and paste (or File > Save) the unified diff

You can also use .patch instead of .diff, which seems to generate input suitable for application with git am.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top