0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

git rebase(既存のブランチをdevelopブランチから作成したようにする方法)

Last updated at Posted at 2025-03-14

ケース

昔branchAをdevelopから作成した
developブランチが他のブランチをマージまたはリベースで更新された。
branchAをdevelopにリベースしたい場合


いわゆる

* 639d8ax - (origin/develop, develop) authorA / commit message 
* 4e18fdx - authorA / commit message 
* a64267x - (origin/branchA, branchA) authorA / commit message 

* 4e18fdx - authorA / commit message 
* a64267x - (origin/branchA, branchA) authorA / commit message 
* 639d8ax - (origin/develop, develop) authorA / commit message 

にしたい(developブランチからbranchAが作成されているようにしたい)


git sw branchA
git rebase --onto origin/develop origin/develop branchA
git push origin branchA --force

補足

$ git log --no-merges --pretty=format:'%C(green)%h %C(reset)-%C(red bold)%d %C(blue)%an %C(reset)/ %C(reset)%s / %ad' --graph develop branchA

でgit treeを見られる

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?