スキップしてメイン コンテンツに移動

gitよく使うコマンド集

よく使うgitのコマンド集をまとめてみた。


1.ローカルリポジトリの登録

 #git init


2.gitの状態を確認

 #git status


3.gitのファイルを追加

 #git add .


4.ローカルのマスタにコミットする

 #git commit -m "体温管理アプリの初期化"


5.リモートリポジトリを登録する

 #git remote add origin https://github.com/ユーザーID/リポジトリ名

 例)git remote add origin https://github.com/githubkyo/taionkanri


6. リモートリポジトリの変更履歴の取得

git fetch origin master


7.差分のあるファイル名を表示

> git diff --name-status ローカルブランチ名 origin/リモートブランチ名

【例】

> git diff --name-status master origin/master


8.リモートのファイルのみをローカルに反映する。

git checkout origin/master --src/Eccube/Resource/template/default/default_frame.twig


9.別ブランチをマスタへマージする

git checkout master

git merge other_branch


以上で、随時更新していく予定。

コメント

このブログの人気の投稿

MongoDB入門編 その1)

mogoDBについて、勉強しながら、紹介していきます。 1.インストール  https://www.mongodb.com/try/download/communityにアクセスして、Available Downloadsの ところから、ダウンロードして、手順に沿ってインストールする。 2.サービスの起動と停止 起動:sudo service mongodb start 停止:sudo service mongodb stop 3.mongoシェルの起動 #mongo 4.実際に使ってみる。 ・用語  MongoDBとRDBとの比較  -------------------------------------  MongoDB          | RDB  -------------------------------------  データベース     | データベース  -------------------------------------  コレクション     | テーブル  -------------------------------------  ドキュメント     | 行(レコード)  -------------------------------------  フィールド       | 列  -------------------------------------   ・データベースの作成  >use study   switched to db study      これだけで、studyというデータベースができました。     > db.stats() {     "db" : "study",     "collections" : 0,     "objects" : 0,     "avgObjSize" : 0,     "dataSize" : 0,     "stora...