'Is there a way to temporarily rebase a feature branch?
How can I take the set of commits in my branch, and rebase them to a temporary branch, and then rebase back to main?
More details-
My branch, my-branch
depends on another code change feature1
that a co-worker should push soon.
I don't want to wait for him, so I created temp-feature1
that contains the desired change.
My plan was to rebase my-branch
above temp-feature1
, and rebase again to main
once main
contains the desired commit.
This is what I did:
During develop
git checkout main
git checkout -b temp-feature1
# commit temp changes that I want to depend on (feature1)
git checkout my-branch
And now I can develop without waiting for my college's commit.
Once feature1
is merged to main
I thought I can simply do -
git checkout main
git pull
git checkout my-branch
git rebase main
And remove my temp-feature1
commit from the log, becuase it's already in main
.
However, the rebase to main returned
Current branch my-branch is up to date.
And temp-feature1
commit was still there.
Is there any way to get this workflow?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|