Skip to content

Instantly share code, notes, and snippets.

@ipetropolsky
Last active August 29, 2015 14:00
Show Gist options
  • Save ipetropolsky/11221747 to your computer and use it in GitHub Desktop.
Save ipetropolsky/11221747 to your computer and use it in GitHub Desktop.
Безопасный ребейз ветки от ветки

Безопасный ребейз ветки от ветки

Из документации

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

Отребейзить обе ветки

o---o---o---o---o  master
     \
      o---o---o---o---o  next
                       \
                        o---o---o  topic
git checkout next
git rebase master
o---o---o---o---o  master
    |            \
    |             o'--o'--o'--o'--o'  next
     \
      o---o---o---o---o  next^
                       \
                        o---o---o  topic
git checkout topic
git rebase --onto next next^ topic
o---o---o---o---o  master
                 \
                  o'--o'--o'--o'--o'  next
                                   \
                                    o'--o'--o'  topic

Готово.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment