githubへ入門した
ほかのサイトにもあるので省略するが、まずgithubのサイトに登録し使用できるよう準備。
remoto repogitoryを作成し、一通り実行したことを備忘録。
https://github.com/Kenichiro-bit/edge_cnn.git
まずgit bashにて
$ mkdir github
$ cd github/
$ mkdir pushtest
$ cd pushtest/
$ git init
Initialized empty Git repository in C:/Users/takig/github/pushtest/.git/
git init でローカルリポジトリを作成した
$ touch test.txt
$ git add test.txt
git add でローカルの中のキャッシュ?に保存
$ git commit -m test.txt
これでコミット完了。-mはメッセージを残すことらしい。
$ git log
で変更履歴を取得。
$ git remote add origin https://github.com/Kenichiro-bit/edge_cnn.git
$ git push origin master
これで、githubのリモートリポジトリの中にpush成功。しかし、mainには反映されていない??
masterというブランチで登録されてしまった。。。これでは、きちんとpushできない。。。
なので、mainのブランチを作ってそれをpushする形で対応。
$ git merge --allow-unrelated-histories origin/main
$ git push origin main
これで、mainにpushすることができた。
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 20 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 379 bytes | 189.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
remote:
remote: Create a pull request for 'testd' on GitHub by visiting:
remote: https://github.com/Kenichiro-bit/edge_cnn/pull/new/testd
remote:
To https://github.com/Kenichiro-bit/edge_cnn.git
* [new branch] testd -> testd
こんな感じ。
試しに、dirも作ってそれをpushしてみる。
$ git branch testd
$ git checkout testd
$ mkdir test1
$ cd test1/
$ touch gogo.txt
$ cd ../
$ git add test1/
$ git status
On branch testd
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: test1/gogo.txt
$ git commit -m test1/
$ git push origin testd
$ git checkout main
$ git merge testd main
$ git push origin main
これで、mainにtestdを追加して、push成功。。。。
初めてのgithubちょっと難しかったけど便利であることは分かった。ここから開発を始めていきたい