1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

git rebaseの例

Last updated at Posted at 2020-09-13

Assumption

  • Sample branches' status
            /--- commit1--- commit2     `feature-1`
           /
*----*----*    `develop`
           \
            \--- commitA --- commitB    `feature-A`
  • Changes in branch feature-1 and feature-A have no conflicts

Do a rebase

Case 1: On branch feature-A, rebase branch feature-1

$ git checkout feature-A
$ git rebase feature-1

First, rewinding head to replay your work on top of it...
Applying: commitA
Applying: commitB

  • Then the commit history will look like this:
                                     /--- commitA --- commitB   `feature-A `
                                    /
            /--- commit1--- commit2   `feature-1`
           /
*----*----*   `develop`                   

Case 2: On branch feature-1, rebase branch feature-A

$ git checkout feature-1
$ git rebase feature-A

First, rewinding head to replay your work on top of it...
Applying: commit1
Applying: commit2

  • Then the commit history will look like this:
                                     /--- commit1 --- commit2   `feature-1 `
                                    /
            /--- commitA--- commitB   `feature-A`
           /
*----*----*   `develop`                   
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?