github入門 基本コマンドまとめ(push,commit,add)

git プログラミング

git github 基本コマンドまとめ

今回はgithubへのpushや基本的使い方を紹介します

git のインストール

ターミナルでのコマンド(windows はコマンドプロンプト)

 $ sudo apt-get update
 $ sudo apt-get install git

上記のコマンドでインストールできます

$ git --version

でインストールした git のバージョンが表示されます

初めての Push

最初の push は READ.md のみを行います

$ echo "#sample" >> README.md  #最初のpushは、READ.mdのみをpushします
$ git init                     
$ git add README.md
$ git commit -m "first commit"
$ git branch -M main
$ git remote add origin https://github.com/<ユーザー名>/sample.git
$ git push -u origin main

二回目以降の Push

$ git remote add origin https://github.com/<ユーザー名>/sample.git
$ git branch -M main
$ git push -u origin main

シェルスクリプトショートカット

一個前のコマンド

control + p or ↑

一個下のコマンド

control - n or ↓

コマンド履歴

history

予測変換確定

control + F or →

vscode を開く

code .
code <ファイルパス>

コメント

タイトルとURLをコピーしました