21 lines
757 B
Markdown
21 lines
757 B
Markdown
---
|
|
title: "move branch"
|
|
date: 2020-01-11T05:06:49+01:00
|
|
draft: false
|
|
snippet_types: ["git"]
|
|
---
|
|
|
|
```shell
|
|
$ git rebase source-commit --onto target-branch
|
|
```
|
|
|
|
Sometimes you need to start a new feature branch but the place you need to base the branch is not
|
|
ready yet, say coworker has merged his changes to a stage branch but not master. With this work flow
|
|
you simply start your branch off stage then move to master later. **git branch -m new-name** also
|
|
comes in handy to rename the branch after you've moved it if need be.
|
|
|
|
source:
|
|
|
|
[makandracards](https://makandracards.com/makandra/10173-git-how-to-rebase-your-feature-branch-from-one-branch-to-another)
|
|
|
|
[w3docs](https://www.w3docs.com/snippets/git/how-to-rename-git-local-and-remote-branches.html)
|