Takuya Miyashita
This site
Web
Start:
*別ブランチでコミット [#u56921e0]
**簡単に [#b8f97d8a]
別のブランチでコミットしたかったけど,既にコミットしたく...
master ブランチにいるけど,まだ master には入れずに dev ...
+stash で現在の内容を保存
#codeprettify{{
git stash # -u (--include-untracked) をつけるとバージョ...
}}
~
+checkout でブランチの移動
#codeprettify{{
git checkout dev # 新たにブランチを作成する場合は -b をつ...
}}
~
+stash したものを移動したブランチで適用
#codeprettify{{
git stash pop # stash は適用後に削除
}}
または
#codeprettify{{
git stash drop # stash が適用後も残る
}}
~
+add して commit
#codeprettify{{
git add .
git commit
}}
**ブランチごとにそれぞれ別ファイルの変更をコミット [#o18d...
【変更内容が未コミット】で~
変更済みファイルが【複数】あり~
それぞれ【別のブランチで】コミットしたい時の話.
-masterブランチでコミットしたいファイル→ fileA
-anotherブランチでコミットしたいファイル→ fileB~
という前提で,masterブランチにいるとする.
+fileA を master ブランチでコミット.(push)
#codeprettify{{
git add fileA
git commit
git push origin
}}
~
+stash で fileB の状態を保存しておく
#codeprettify{{
git stash -u
}}
~
+checkout で another ブランチに切り替え
#codeprettify{{
git checkout another
}}
~
+log を見て stash 状態のコミットのハッシュを確認する (git...
#codeprettify{{
git log -n 5 --all --decorate --oneline
}}
~
+ハッシュ値を入力して前の状態の fileB を取り戻す~
上記の pop や drop の代わりに apply でも良い.
#codeprettify{{
git stash apply --index 64359e3
}}
~
+fileB を another ブランチとしてコミット.fileA の変更を ...
#codeprettify{{
# git merge origin/master # 必要であれば
git add fileB
git commit
}}
~
End:
*別ブランチでコミット [#u56921e0]
**簡単に [#b8f97d8a]
別のブランチでコミットしたかったけど,既にコミットしたく...
master ブランチにいるけど,まだ master には入れずに dev ...
+stash で現在の内容を保存
#codeprettify{{
git stash # -u (--include-untracked) をつけるとバージョ...
}}
~
+checkout でブランチの移動
#codeprettify{{
git checkout dev # 新たにブランチを作成する場合は -b をつ...
}}
~
+stash したものを移動したブランチで適用
#codeprettify{{
git stash pop # stash は適用後に削除
}}
または
#codeprettify{{
git stash drop # stash が適用後も残る
}}
~
+add して commit
#codeprettify{{
git add .
git commit
}}
**ブランチごとにそれぞれ別ファイルの変更をコミット [#o18d...
【変更内容が未コミット】で~
変更済みファイルが【複数】あり~
それぞれ【別のブランチで】コミットしたい時の話.
-masterブランチでコミットしたいファイル→ fileA
-anotherブランチでコミットしたいファイル→ fileB~
という前提で,masterブランチにいるとする.
+fileA を master ブランチでコミット.(push)
#codeprettify{{
git add fileA
git commit
git push origin
}}
~
+stash で fileB の状態を保存しておく
#codeprettify{{
git stash -u
}}
~
+checkout で another ブランチに切り替え
#codeprettify{{
git checkout another
}}
~
+log を見て stash 状態のコミットのハッシュを確認する (git...
#codeprettify{{
git log -n 5 --all --decorate --oneline
}}
~
+ハッシュ値を入力して前の状態の fileB を取り戻す~
上記の pop や drop の代わりに apply でも良い.
#codeprettify{{
git stash apply --index 64359e3
}}
~
+fileB を another ブランチとしてコミット.fileA の変更を ...
#codeprettify{{
# git merge origin/master # 必要であれば
git add fileB
git commit
}}
~
Page:
Edit with a page name which already exists