LoginSignup
1
1

More than 1 year has passed since last update.

git コマンド 勉強用

Last updated at Posted at 2021-04-29
…or create a new repository on the command line
echo "# diarys" >> README.md

git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/ke158/diarys.git
git push -u origin main

…or push an existing repository from the command line
git remote add origin https://github.com/ke158/diarys.git
git branch -M main
git push -u origin main

初期設定を行う

//ユーザー名の登録
git config --global user.name "XXXX"
//メールアドレスの登録
git config --global user.email "XXXX@hogehoge.com"

ローカルにリポジトリを作成し、リモートにプッシュする

アップロードしたいフォルダの場所

フォルダ名を入力するか、ファイルをドラッグ&ドロップする。

cd [フォルダ名]

Gitのリポジトリを新たに作成する

既にあるリポジトリを再初期化するためのものでもある。

git init

ファイルを追加

[.]は全てのファイルを追加
指定したファイルを追加したい時は $ git add <ファイル名>で指定する。

git add .

ファイルの変更や追加をコミット

git commit -m "任意のメッセージ"

git commit -m "first commit"

ローカルの変更を確認する

git status

originという名前に対して[URL]を関連付けさせる。

git remote add origin [URL]
(githubにアップする場合はgithubのリモートリポジトリのURLを指定)

git remote add origin https://github.com/XXXX/XXXXXX.git

masterを更新,追加

リモートリポジトリにアップロード(プッシュ)

git push -u origin master

1
1
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
1
1