新石器Wiki

近年はシリコン(石)から進化した便利なもので溢れる時代。そんな気になった事や試した事など記す。

ユーザ用ツール

サイト用ツール


software:git:git-basic-commands


差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
software:git:git-basic-commands [2019/10/18 10:13] – [clone] yokosoftware:git:git-basic-commands [2026/07/28 13:16] (現在) – 外部編集 127.0.0.1
行 1: 行 1:
-Gitでよく使うコマンド +====== Gitでよく使うコマンド ====== 
-=================== +通常は[[software:git:git-gui-client:sourcetree:start]]からGit操作するのだが、たまにコンソールからコマンド操作する事がある備忘録。
-よく使うGitコマンドの備忘録。+
  
-clone +===== Gitリポジトリ取得 ===== 
------ +cloneについては、「[[software/git/git-clone-recursive]]」記事参照。
-リポジトリ取得については、「[[software/git/git-clone-recursive]]」記事参照。+
  
-リモートブランチの取得 
--------------------- 
  
-### リモートにどんなブランチがあるか調べる+===== よく使うGitコマンド ===== 
 + 
 +### リモートブランチの取得 
 + 
 +#### リモートにどんなブランチがあるか調べる
  
 <code bash> <code bash>
行 38: 行 38:
 `git checkout -b other_branch` `git checkout -b other_branch`
  
-参考 +### 現在の状況確認 
-----+いまのブランチや、前回のコミットと比較してどのファイルが変更されたの状況表示。 
 + 
 +<code bash> 
 +$ git status 
 +ブランチ master 
 +Your branch is up to date with 'origin/master'
 + 
 +nothing to commit, working tree clean 
 +</code> 
 + 
 +### ブランチを切り替える 
 + 
 +#### ブランチを変更 
 + 
 +<code bash> 
 +$ git checkout develop 
 +Switched to branch 'develop' 
 +Your branch is up to date with 'origin/develop'
 +</code> 
 + 
 +### インデックス(ステージ)に追加 
 + 
 +#### ファイルやディレクトリをインデックスに登録 
 + 
 +<code bash> 
 +$ git add [filename] 
 +</code> 
 + 
 +#### すべての変更がある内容をインデックスに追加 
 + 
 +<code bash> 
 +$ git add -A 
 +</code> 
 + 
 +### コミット 
 + 
 +#### インデックスに追加されたファイルをコミット 
 + 
 +<code bash> 
 +$ git commit 
 +</code> 
 + 
 +#### コミットメッセージを同時に指定 
 + 
 +<code bash> 
 +$ git commit -m "[comment]" 
 +</code> 
 + 
 +#### 変更されたファイルをインデックスに追加しコミット 
 + 
 +<code bash> 
 +$ git commit -a 
 +</code> 
 + 
 +  * 但し、新規追加されたものは含まれないので、必要があれば `add` で事前に追加。  
 + 
 +###push 
 + 
 +#### リモートリポジトリに書き込む 
 + 
 +<code bash> 
 +$ git push [remote repository PATH] [branch] 
 +</code> 
 + 
 +  * 引数を省略すると、今のブランチを書き込む。 
 + 
 +### pull 
 + 
 +#### リモートリポジトリの変更の取り込み 
 + 
 +<code bash> 
 +$ git pull [remote repository PATH] [branch] 
 +</code> 
 + 
 +  * 引数を省略すると、今のブランチを読み込む。 
 + 
 +### remote 
 + 
 +#### リモートリポジトリの一覧表示 
 + 
 +<code bash> 
 +$ git remote 
 +</code> 
 + 
 +### fetch 
 + 
 +#### リモートリポジトリの最新情報を取得 
 + 
 +<code bash> 
 +$ git fetch 
 +</code> 
 + 
 +===== 参考 ===== 
 + 
 +  [[https://www.setoya-blog.com/entry/2012/11/04/132746|リモートのgitブランチをローカルにチェックアウトする]] 
 +  - [[https://qiita.com/2m1tsu3/items/6d49374230afab251337|基本的なGitコマンドまとめ]] 
 + 
 +- - -
  
-1. [[https://www.setoya-blog.com/entry/2012/11/04/132746|リモートのgitブランチをローカルにチェックアウトする]] 
-2. [[https://qiita.com/2m1tsu3/items/6d49374230afab251337|基本的なGitコマンドまとめ]] 
software/git/git-basic-commands.1571361182.txt.gz · 最終更新: by yoko