やりたいこと
github にpush, pullrequestしたい。
環境:
git : git version 2.35.1.windows.1
editor : IntelliJ IDEA 2021.3.1 (Ultimate Edition)
A: 自分, B: 送り先
1つ目 (push)
A (ローカル) branch: main
↓ push
A (リモート) branch: main
今やっているやり方
git
1git init 2git add . 3git commit -m 'first commit' 4git remote add origin https://github.com/.../... 5git push -u origin main
結果
PS C:\program\github> git push -u origin main To https://github.com/.../... ! [rejected] main -> main (fetch first) error: failed to push some refs to 'https://github.com/.../...' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
2つ目 (pullrequest)
A (ローカル) branch: main
↓ pullrequest
B (リモート) branch: dev
こちらはやり方がわかりません。
回答お願いします。
GitHub のリポジトリに README.md があるのではないでしょうか。
自分のリポジトリには元からあったものしかありません。
https://gyazo.com/61c8c5f8e227e32345885c58935907f3
エラーメッセージで検索したら過去の質問が出てきました。
https://teratail.com/questions/187949
GITの基本原理を解答欄で解説するのは長文が必要になり厳しいものがあると思います。
元からあったものがあるなら同じことです。
最初に作られた README.md が不要なら、git push -f してしまうとか…。
回答2件
あなたの回答
tips
プレビュー