user4676340
user4676340

Reputation:

GIT : do a correct rebase

This is my current GIT state :

0
|\
| \
|  \
|   \
|    1
|    |\
|    | \
|    |  \
|    |   \
|    1    2
|   /     |
|  /      |
| /       |
0         |
|         |
|         |
|         |

The branch 0 is master

The branch 1 is a new feature that has been reviewed, then modified, then merged.

The branch 2 is starting from the branch 1 before it has been reviewed : this means it has the feature, but it is lacking some modifications.

Issue

I would like to incorporate the changes that have been made & merged into my branch 2.

What is the correct command to run, and on which branch ?

EDIT the file that is creating a conflict :

old state :

import { Observable } from 'rxjs/Observable';
import { Injectable } from '@angular/core';

export const mockedData ...

new state :

import { Observable } from 'rxjs/Observable';
import { Injectable } from '@angular/core';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/delay';

export const mockedData ...

Upvotes: 2

Views: 66

Answers (2)

SanchelliosProg
SanchelliosProg

Reputation: 2331

If you want to incorporate chenges from branch-0 to branch-2, you shlould:

1 - checkout to the branch-0

git checkout 0

2 - rebase that branch to the branch-2

git rebase 2

3 - solve your conflicts and stage your changes

git add *

4 - continue your rebase

git rebase --continue

Upvotes: 0

Maroun
Maroun

Reputation: 95948

Use rebase:

git checkout branch_2
git rebase branch_0

Upvotes: 2

Related Questions