Gitでコミットするブランチを間違えた場合に、コミットを別のブランチにつけなおす
勝手に作ったグラフなので、このレイアウト通りに生成されるかはわからないhttps://gyazo.com/e6a1e8702aabac0c836f3fd98911881c
code:bash
* b82874n 2023-03-22 (feature2) feature2...
| * 2b88c8e 2023-06-18 (HEAD -> feature1) このコミットを間違えた
| * 2c31234 2023-04-20 featurefeature...
| * 22832c3 2023-03-24 feature...
|/
| * 5728s74 2023-03-20 (develop) 開発中
| * 3b19283 2023-02-19 hoge...
| * b283sse 2022-06-14 hogehoge...
|/
* 878fk2f 2022-03-22 hoge
こうしたい
code:bash
* b82874n 2023-03-22 (feature2) feature2...
| * 2c31234 2023-04-20 (feature1) featurefeature... # feature1ブランチを1つ前に戻しまして
| * 22832c3 2023-03-24 feature...
|/
| * 2b88c8e 2023-06-18 (HEAD -> feature3) このコミットを間違えた # 間違えたコミットをdevelopから生やしたい
| * 5728s74 2023-03-20 (develop) 開発中
| * 3b19283 2023-02-19 hoge...
| * b283sse 2022-06-14 hogehoge...
|/
* 878fk2f 2022-03-22 hoge
code:mmd
gitGraph LR:
commit
branch develop
commit
commit
branch feature1
commit
commit
commit id:"ABCDEF..." tag:"HEAD(間違えた)" type:REVERSE
checkout develop
branch feature2
commit
code:mmd
gitGraph LR:
commit
branch develop
commit
commit
branch feature1
commit
commit
checkout develop
branch feature2
commit
checkout develop
branch feature3
commit id:"ABCDEF..." tag:"HEAD(こうしたかった)"