1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

すぐ理解できる!覚えるべきGitコマンド5選【初心者向けまとめ】

1
Posted at

すぐ理解できる!覚えるべきGitコマンド5選
【初心者向けまとめ】

Gitは便利だけど、初心者にとっては「コマンドが覚えられない…」という
壁があります。そこで今回は、最低限これだけ覚えれば困らないGitコマンド
5選を簡単に紹介します。

1. git init

新しいプロジェクトをGitで管理したいときに使うコマンド。


git init

  • 現在のディレクトリをGitリポジトリに変換
  • .gitフォルダが作成され、履歴管理が可能

2. git clone

既存のリポジトリをコピーして作業を始めたいときに使うコマンド。


git clone https://github.com/ユーザー名/リポジトリ名.git

  • リモートリポジトリをローカルに複製
  • チーム開発で最初に必ず使う

3. git add

変更したファイルを「コミット対象」にするコマンド。


git add ファイル名
git add .

  • git add .で全ファイルをまとめて追加
  • コミット前の必須ステップ

4. git commit

変更を履歴として保存するコマンド。


git commit -m "変更内容をここに書く"

  • -mオプションでメッセージを付ける
  • 「いつ」「何をしたか」がわかるように書くのがポイント

5. git push

ローカルの変更をリモートリポジトリに反映する。


git push origin main

  • originはリモートリポジトリの名前
  • mainはブランチ名

おわりに

初心者がまず覚えるべきGitコマンドは以下の5つ

  • git init
  • git clone
  • git add
  • git commit
  • git push

この5つをマスターすれば、Gitの基本操作はほぼ問題なくこなせます。
Gitは非常に便利なので皆さんもぜひ使ってみてください。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?