Answer the question
In order to leave comments, you need to log in
How to fix the root of a branch in git?
I recently got acquainted with git, but I can’t imagine how I coded without it.
So, as it was: I described one feature (3 commits allocated), but then I realized that it would take too much time and put it off, taking on the immediate tasks (sidebar branch). After the layout and basic revival of that siderab, I made a commit and saw that there was a bug that should have been covered (iss_20), but even here the branch for some reason was created from under the iss_18 branch, and not from under the master (although I am 100% sure that created from under it).
In general, I need to return the basis of the sidebar and iss_20 branches to the master, because it turns out the wrong picture of development.
Answer the question
In order to leave comments, you need to log in
git rebase --onto <куда> <начало ветки> <конец ветки>
First let’s assume your topic is based on branch next.
For example, a feature developed in topic depends on some functionality
which is found in next.
o---o---o---o---o master
\
o---o---o---o---o next
\
o---o---o topic
We want to make topic forked from branch master;
for example, because the functionality on which topic depends
was merged into the more stable master branch.
We want our tree to look like this:
o---o---o---o---o master
| \
| o'--o'--o' topic
\
o---o---o---o---o next
We can get this using the following command:
git rebase --onto master next topic
Display bug? The start of the Sidebar branch is not tied to any commit.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question