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-spice】ブランチをベースブランチにマージする方法

Last updated at Posted at 2025-08-19

gs branch foldを使用すると現在のブランチをそのベースブランチにマージし、元のブランチを削除できます。

基本的な構文

gs branch fold [flags]

動作

以下のようなブランチスタックがあるとします。

    ┌── C
  ┌─┴ B ◀ (現在のブランチ)
┌─┴ A
trunk

gs branch foldを実行すると

  ┌── C
┌─┴ A (BのコミットがAにマージされる)
trunk
  • ブランチBのコミットがブランチAにマージされます
  • ブランチBは削除されます
  • ブランチCは自動的にブランチAを指すように更新されます

フラグ

--branch=NAME

対象となるブランチを指定します。このフラグを使用すると、現在のブランチ以外のブランチをマージできます。

# 現在のブランチをfoldする(デフォルト)
gs branch fold

# 特定のブランチをfoldする
gs branch fold --branch feature-branch

参考

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