0
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?

gitでトピックブランチをmainブランチに綺麗にリベースする方法

Posted at

はじめに

gitでトピックブランチをmainブランチにリベースした時 git のlogが汚くなってしまわないためのメモ

前提:我々のチームではトピックブランチはmainにリベースを行いlogを直線的に保っています。

結論

--ff-only feature/my-topic
をつけないと下記手順の場合logが汚れてしまう。

1 ローカルを最新の状態に更新し、トピックブランチをmainでリベース

git checkout feature/my-topic
git fetch origin
git rebase origin/main

2 mainブランチに移動し mainブランチにマージ

git checkout main
git merge --ff-only feature/my-topic

※mainへのマージが禁止されPull Request (PR) を使う運用の場合

base main
compare feature/my-topic

✅ Rebase and merge
を選択する。

0
0
1

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
0
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?