0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

GitHubでコミットの差分のPullRequestを作成する方法

Last updated at Posted at 2020-08-27

やりたい事

Githubでmasterブランチの一番最初(一番古い)のコミットと最新のコミットの差分のPullRequestを作成する。

手順

1. 一番最初のコミットのコミットIDを確認します。
2. ローカルのmasterブランチ上で下記コマンドを実行します。
$ git checkout 一番最初のコミットID 

Note: switching to 'xxxxxxxxxxxxxxxxxxxxxx'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at xxxxxxx first commit
3. メッセージにしたがって下記コマンドを実行して下さい。first-commitのところは自分の好きな名前に変えて大丈夫です。
$ git switch -c first-commit
4. 現在いるブランチがfirst-commitである事を確認します。
$ git branch
* first-commit
  master
5. GitHubにpushします。
$ git push origin first-commit
6. GitHubでPRを作成します。baseのブランチを今プッシュしたfirst-commitにして、compareはmasterブランチを指定します。

image.png

以上で完了です✨

参考

git - How to get certain commit from GitHub project - Stack Overflow

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?