Gitの簡単な使い方
- Mon
- 00:20
- misc
Gitの簡単な使い方
branchの作り方からcommitまで
やりたいこと | コマンド |
ブランチの作成 | $ git branch ブランチ名 |
ブランチの切替 | $ git checkout ブランチ名 |
commit済fileの取得 | $ git checkout ファイル名 |
localの変更をremoteへ反映 | $ git push origin リモートブランチ名 |
remoteの変更をlocalに反映 | $ git pull $ git pull origin ブランチ名 |
localブランチの削除 | $ git branch -d ブランチ名 |
remoteブランチの削除 | $ git push -delete origin リモートブランチ名 |
remoteブランチの取得 | $ git checkout localブランチ名 origin/リモートブランチ名 |
localとremoteのdiff | (commit後) $ git diff master origin/master (変更前のローカルブランチ) $ git fetch $ git diff master origin/master (masterは任意のブランチ名に変更) |
git管理されているファイルの表示 | $ git ls-files |
git管理されていないファイルの表示 | $ git ls-files --others --exclude-standard |
commit履歴の確認 | $ git log [-p ファイルパス] |
remote masterの変更をlocalのブランチに反映
1. $ git checkout masterまず、materに切替
2. $ git pull origin matermaterの変更をlocalに反映
3. $ git checkout branch-dev現在変更中の開発ブランチに切替
4. $ git merge mastermasterの内容を開発ブランチにマージ
ここでコンフリクトが出る場合がある
5. $ git push origin branch-devここでコンフリクトが出る場合がある
masterをマージした開発ブランチをremoteにアップロード
この後で開発ブランチのPRを行う
この後で開発ブランチのPRを行う
- 関連記事
Comment
Trackback
- URL
- https://nosource.blog.fc2.com/tb.php/139-11f86405
- この記事にトラックバック(FC2Blog User)