From 0659c2b5e91de2e4b2617291f6abfb640a7ec7cd Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 30 Aug 2024 14:25:23 +0200 Subject: [PATCH 1/2] Add free-standing function IsWorkingTreeDirty The long story: I want to call this function from RefsHelper; however, I can't make WorkingTreeHelper a field of RefsHelper because RefsHelper is already a field in WorkingTreeHelper, so that would be a circular dependency. The shorter story: there's really little reason to have to instantiate a helper object in order to call a simple function like this. Long term I would like to get to a state where a lot more of these helper functions are free-standing, and you pass in the data they need. While at it, simplify the implementation of AnyStagedFiles and AnyTrackedFiles to one-liners. --- .../helpers/working_tree_helper.go | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/pkg/gui/controllers/helpers/working_tree_helper.go b/pkg/gui/controllers/helpers/working_tree_helper.go index 96baaeebe14..0b8c85ea251 100644 --- a/pkg/gui/controllers/helpers/working_tree_helper.go +++ b/pkg/gui/controllers/helpers/working_tree_helper.go @@ -9,6 +9,7 @@ import ( "github.com/jesseduffield/lazygit/pkg/config" "github.com/jesseduffield/lazygit/pkg/gui/context" "github.com/jesseduffield/lazygit/pkg/gui/types" + "github.com/samber/lo" ) type IWorkingTreeHelper interface { @@ -40,25 +41,27 @@ func NewWorkingTreeHelper( } func (self *WorkingTreeHelper) AnyStagedFiles() bool { - for _, file := range self.c.Model().Files { - if file.HasStagedChanges { - return true - } - } - return false + return AnyStagedFiles(self.c.Model().Files) +} + +func AnyStagedFiles(files []*models.File) bool { + return lo.SomeBy(files, func(f *models.File) bool { return f.HasStagedChanges }) } func (self *WorkingTreeHelper) AnyTrackedFiles() bool { - for _, file := range self.c.Model().Files { - if file.Tracked { - return true - } - } - return false + return AnyTrackedFiles(self.c.Model().Files) +} + +func AnyTrackedFiles(files []*models.File) bool { + return lo.SomeBy(files, func(f *models.File) bool { return f.Tracked }) } func (self *WorkingTreeHelper) IsWorkingTreeDirty() bool { - return self.AnyStagedFiles() || self.AnyTrackedFiles() + return IsWorkingTreeDirty(self.c.Model().Files) +} + +func IsWorkingTreeDirty(files []*models.File) bool { + return AnyStagedFiles(files) || AnyTrackedFiles(files) } func (self *WorkingTreeHelper) FileForSubmodule(submodule *models.SubmoduleConfig) *models.File { From 67a61e41df89f7354ee4a4c0b8248dba5bdb9e04 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 30 Aug 2024 12:27:50 +0200 Subject: [PATCH 2/2] Add new command "Move commits to new branch" --- docs/Config.md | 1 + docs/keybindings/Keybindings_en.md | 12 ++++ docs/keybindings/Keybindings_ja.md | 12 ++++ docs/keybindings/Keybindings_ko.md | 12 ++++ docs/keybindings/Keybindings_nl.md | 12 ++++ docs/keybindings/Keybindings_pl.md | 12 ++++ docs/keybindings/Keybindings_ru.md | 12 ++++ docs/keybindings/Keybindings_zh-CN.md | 12 ++++ docs/keybindings/Keybindings_zh-TW.md | 12 ++++ pkg/commands/git_commands/branch.go | 9 +++ pkg/config/user_config.go | 2 + .../controllers/basic_commits_controller.go | 19 +++++ pkg/gui/controllers/branches_controller.go | 15 ++++ pkg/gui/controllers/helpers/refs_helper.go | 71 +++++++++++++++++++ pkg/i18n/english.go | 12 ++++ .../branch/move_commits_to_new_branch.go | 56 +++++++++++++++ .../move_commits_to_new_branch_no_upstream.go | 31 ++++++++ pkg/integration/tests/test_list.go | 2 + schema/config.json | 4 ++ 19 files changed, 318 insertions(+) create mode 100644 pkg/integration/tests/branch/move_commits_to_new_branch.go create mode 100644 pkg/integration/tests/branch/move_commits_to_new_branch_no_upstream.go diff --git a/docs/Config.md b/docs/Config.md index ce0c4bee1f6..7f36aacd243 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -557,6 +557,7 @@ keybinding: rebaseBranch: r renameBranch: R mergeIntoCurrentBranch: M + moveCommitsToNewBranch: "N" viewGitFlowOptions: i fastForward: f createTag: T diff --git a/docs/keybindings/Keybindings_en.md b/docs/keybindings/Keybindings_en.md index 214b7359a6d..0a9988e8ce7 100644 --- a/docs/keybindings/Keybindings_en.md +++ b/docs/keybindings/Keybindings_en.md @@ -105,6 +105,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | Open commit in browser | | | `` n `` | Create new branch off of commit | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | Copy (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | Open external diff tool (git difftool) | | @@ -157,6 +160,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` i `` | Show git-flow options | | | `` `` | Checkout | Checkout selected item. | | `` n `` | New branch | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` o `` | Create pull request | | | `` O `` | View create pull request options | | | `` `` | Copy pull request URL to clipboard | | @@ -253,6 +259,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | Open commit in browser | | | `` n `` | Create new branch off of commit | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | Copy (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | Reset copied (cherry-picked) commits selection | | @@ -322,6 +331,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | Open commit in browser | | | `` n `` | Create new branch off of commit | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | Copy (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | Reset copied (cherry-picked) commits selection | | diff --git a/docs/keybindings/Keybindings_ja.md b/docs/keybindings/Keybindings_ja.md index a433e97b6dc..91e7bcba1ef 100644 --- a/docs/keybindings/Keybindings_ja.md +++ b/docs/keybindings/Keybindings_ja.md @@ -73,6 +73,9 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | `` y `` | コミットの情報をコピー | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | ブラウザでコミットを開く | | | `` n `` | コミットにブランチを作成 | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | コミットをコピー (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | Reset copied (cherry-picked) commits selection | | @@ -122,6 +125,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` y `` | コミットの情報をコピー | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | ブラウザでコミットを開く | | | `` n `` | コミットにブランチを作成 | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | コミットをコピー (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | Open external diff tool (git difftool) | | @@ -228,6 +234,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` i `` | Show git-flow options | | | `` `` | チェックアウト | Checkout selected item. | | `` n `` | 新しいブランチを作成 | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` o `` | Pull Requestを作成 | | | `` O `` | View create pull request options | | | `` `` | Pull RequestのURLをクリップボードにコピー | | @@ -353,6 +362,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` y `` | コミットの情報をコピー | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | ブラウザでコミットを開く | | | `` n `` | コミットにブランチを作成 | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | コミットをコピー (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | Reset copied (cherry-picked) commits selection | | diff --git a/docs/keybindings/Keybindings_ko.md b/docs/keybindings/Keybindings_ko.md index cbafa9476e1..e56b4eba1e0 100644 --- a/docs/keybindings/Keybindings_ko.md +++ b/docs/keybindings/Keybindings_ko.md @@ -60,6 +60,9 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | `` y `` | 커밋 attribute 복사 | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | 브라우저에서 커밋 열기 | | | `` n `` | 커밋에서 새 브랜치를 만듭니다. | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | View reset options | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | 커밋을 복사 (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | Reset cherry-picked (copied) commits selection | | @@ -90,6 +93,9 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | `` y `` | 커밋 attribute 복사 | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | 브라우저에서 커밋 열기 | | | `` n `` | 커밋에서 새 브랜치를 만듭니다. | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | View reset options | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | 커밋을 복사 (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | Reset cherry-picked (copied) commits selection | | @@ -184,6 +190,9 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | `` i `` | Git-flow 옵션 보기 | | | `` `` | 체크아웃 | Checkout selected item. | | `` n `` | 새 브랜치 생성 | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` o `` | 풀 리퀘스트 생성 | | | `` O `` | 풀 리퀘스트 생성 옵션 | | | `` `` | 풀 리퀘스트 URL을 클립보드에 복사 | | @@ -287,6 +296,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` y `` | 커밋 attribute 복사 | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | 브라우저에서 커밋 열기 | | | `` n `` | 커밋에서 새 브랜치를 만듭니다. | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | View reset options | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | 커밋을 복사 (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | Open external diff tool (git difftool) | | diff --git a/docs/keybindings/Keybindings_nl.md b/docs/keybindings/Keybindings_nl.md index f63dc02600e..8c79563c3e6 100644 --- a/docs/keybindings/Keybindings_nl.md +++ b/docs/keybindings/Keybindings_nl.md @@ -96,6 +96,9 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | `` i `` | Laat git-flow opties zien | | | `` `` | Uitchecken | Checkout selected item. | | `` n `` | Nieuwe branch | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` o `` | Maak een pull-request | | | `` O `` | Bekijk opties voor pull-aanvraag | | | `` `` | Kopieer de URL van het pull-verzoek naar het klembord | | @@ -169,6 +172,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | Open commit in browser | | | `` n `` | Creëer nieuwe branch van commit | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | Bekijk reset opties | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | Kopieer commit (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | Open external diff tool (git difftool) | | @@ -231,6 +237,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | Open commit in browser | | | `` n `` | Creëer nieuwe branch van commit | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | Bekijk reset opties | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | Kopieer commit (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | Reset cherry-picked (gekopieerde) commits selectie | | @@ -322,6 +331,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | Open commit in browser | | | `` n `` | Creëer nieuwe branch van commit | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | Bekijk reset opties | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | Kopieer commit (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | Reset cherry-picked (gekopieerde) commits selectie | | diff --git a/docs/keybindings/Keybindings_pl.md b/docs/keybindings/Keybindings_pl.md index 952cd083703..fa6a65928bd 100644 --- a/docs/keybindings/Keybindings_pl.md +++ b/docs/keybindings/Keybindings_pl.md @@ -82,6 +82,9 @@ Jeśli chcesz zamiast tego rozpocząć interaktywny rebase od wybranego commita, | `` y `` | Kopiuj atrybut commita do schowka | Kopiuj atrybut commita do schowka (np. hash, URL, różnice, wiadomość, autor). | | `` o `` | Otwórz commit w przeglądarce | | | `` n `` | Utwórz nową gałąź z commita | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | Reset | Wyświetl opcje resetu (miękki/mieszany/twardy) do wybranego elementu. | | `` C `` | Kopiuj (cherry-pick) | Oznacz commit jako skopiowany. Następnie, w widoku lokalnych commitów, możesz nacisnąć `V`, aby wkleić (cherry-pick) skopiowane commity do sprawdzonej gałęzi. W dowolnym momencie możesz nacisnąć ``, aby anulować zaznaczenie. | | `` `` | Otwórz zewnętrzne narzędzie różnic (git difftool) | | @@ -122,6 +125,9 @@ Jeśli chcesz zamiast tego rozpocząć interaktywny rebase od wybranego commita, | `` i `` | Pokaż opcje git-flow | | | `` `` | Przełącz | Przełącz wybrany element. | | `` n `` | Nowa gałąź | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` o `` | Utwórz żądanie ściągnięcia | | | `` O `` | Zobacz opcje tworzenia pull requesta | | | `` `` | Kopiuj adres URL żądania ściągnięcia do schowka | | @@ -263,6 +269,9 @@ Jeśli chcesz zamiast tego rozpocząć interaktywny rebase od wybranego commita, | `` y `` | Kopiuj atrybut commita do schowka | Kopiuj atrybut commita do schowka (np. hash, URL, różnice, wiadomość, autor). | | `` o `` | Otwórz commit w przeglądarce | | | `` n `` | Utwórz nową gałąź z commita | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | Reset | Wyświetl opcje resetu (miękki/mieszany/twardy) do wybranego elementu. | | `` C `` | Kopiuj (cherry-pick) | Oznacz commit jako skopiowany. Następnie, w widoku lokalnych commitów, możesz nacisnąć `V`, aby wkleić (cherry-pick) skopiowane commity do sprawdzonej gałęzi. W dowolnym momencie możesz nacisnąć ``, aby anulować zaznaczenie. | | `` `` | Resetuj wybrane (cherry-picked) commity | | @@ -303,6 +312,9 @@ Jeśli chcesz zamiast tego rozpocząć interaktywny rebase od wybranego commita, | `` y `` | Kopiuj atrybut commita do schowka | Kopiuj atrybut commita do schowka (np. hash, URL, różnice, wiadomość, autor). | | `` o `` | Otwórz commit w przeglądarce | | | `` n `` | Utwórz nową gałąź z commita | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | Reset | Wyświetl opcje resetu (miękki/mieszany/twardy) do wybranego elementu. | | `` C `` | Kopiuj (cherry-pick) | Oznacz commit jako skopiowany. Następnie, w widoku lokalnych commitów, możesz nacisnąć `V`, aby wkleić (cherry-pick) skopiowane commity do sprawdzonej gałęzi. W dowolnym momencie możesz nacisnąć ``, aby anulować zaznaczenie. | | `` `` | Resetuj wybrane (cherry-picked) commity | | diff --git a/docs/keybindings/Keybindings_ru.md b/docs/keybindings/Keybindings_ru.md index 2fa0a5d2279..aff5e8e6d67 100644 --- a/docs/keybindings/Keybindings_ru.md +++ b/docs/keybindings/Keybindings_ru.md @@ -130,6 +130,9 @@ _Связки клавиш_ | `` y `` | Скопировать атрибут коммита | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | Открыть коммит в браузере | | | `` n `` | Создать новую ветку с этого коммита | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | Просмотреть параметры сброса | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | Скопировать отобранные коммит (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | Сбросить отобранную (скопированную | cherry-picked) выборку коммитов | | @@ -169,6 +172,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` y `` | Скопировать атрибут коммита | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | Открыть коммит в браузере | | | `` n `` | Создать новую ветку с этого коммита | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | Просмотреть параметры сброса | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | Скопировать отобранные коммит (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | Open external diff tool (git difftool) | | @@ -184,6 +190,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` i `` | Показать параметры git-flow | | | `` `` | Переключить | Checkout selected item. | | `` n `` | Новая ветка | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` o `` | Создать запрос на принятие изменений | | | `` O `` | Создать параметры запроса принятие изменений | | | `` `` | Скопировать URL запроса на принятие изменений в буфер обмена | | @@ -227,6 +236,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` y `` | Скопировать атрибут коммита | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | Открыть коммит в браузере | | | `` n `` | Создать новую ветку с этого коммита | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | Просмотреть параметры сброса | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | Скопировать отобранные коммит (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | Сбросить отобранную (скопированную | cherry-picked) выборку коммитов | | diff --git a/docs/keybindings/Keybindings_zh-CN.md b/docs/keybindings/Keybindings_zh-CN.md index cf9b146021f..6b38df18140 100644 --- a/docs/keybindings/Keybindings_zh-CN.md +++ b/docs/keybindings/Keybindings_zh-CN.md @@ -60,6 +60,9 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | 在浏览器中打开提交 | | | `` n `` | 从提交创建新分支 | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | 查看重置选项 | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | 复制提交(拣选) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | 重置已拣选(复制)的提交 | | @@ -86,6 +89,9 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | `` i `` | 显示 git-flow 选项 | | | `` `` | 检出 | Checkout selected item. | | `` n `` | 新分支 | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` o `` | 创建抓取请求 | | | `` O `` | 创建抓取请求选项 | | | `` `` | 将抓取请求 URL 复制到剪贴板 | | @@ -114,6 +120,9 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | 在浏览器中打开提交 | | | `` n `` | 从提交创建新分支 | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | 查看重置选项 | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | 复制提交(拣选) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | 重置已拣选(复制)的提交 | | @@ -167,6 +176,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | 在浏览器中打开提交 | | | `` n `` | 从提交创建新分支 | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | 查看重置选项 | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | 复制提交(拣选) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | Open external diff tool (git difftool) | | diff --git a/docs/keybindings/Keybindings_zh-TW.md b/docs/keybindings/Keybindings_zh-TW.md index 024bd25553e..e291460de8e 100644 --- a/docs/keybindings/Keybindings_zh-TW.md +++ b/docs/keybindings/Keybindings_zh-TW.md @@ -128,6 +128,9 @@ _說明:`` 表示 Ctrl+B、`` 表示 Alt+B,`B`表示 Shift+B | `` y `` | 複製提交屬性 | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | 在瀏覽器中開啟提交 | | | `` n `` | 從提交建立新分支 | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | 檢視重設選項 | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | 複製提交 (揀選) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | 重設選定的揀選 (複製) 提交 | | @@ -191,6 +194,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` y `` | 複製提交屬性 | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | 在瀏覽器中開啟提交 | | | `` n `` | 從提交建立新分支 | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | 檢視重設選項 | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | 複製提交 (揀選) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | Open external diff tool (git difftool) | | @@ -243,6 +249,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` y `` | 複製提交屬性 | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). | | `` o `` | 在瀏覽器中開啟提交 | | | `` n `` | 從提交建立新分支 | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` g `` | 檢視重設選項 | View reset options (soft/mixed/hard) for resetting onto selected item. | | `` C `` | 複製提交 (揀選) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `` to cancel the selection. | | `` `` | 重設選定的揀選 (複製) 提交 | | @@ -259,6 +268,9 @@ If you would instead like to start an interactive rebase from the selected commi | `` i `` | 顯示 git-flow 選項 | | | `` `` | 檢出 | Checkout selected item. | | `` n `` | 新分支 | | +| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first. + +Note that this disregards the selection, the new branch is always created from the tip of the current branch. | | `` o `` | 建立拉取請求 | | | `` O `` | 建立拉取請求選項 | | | `` `` | 複製拉取請求的 URL 到剪貼板 | | diff --git a/pkg/commands/git_commands/branch.go b/pkg/commands/git_commands/branch.go index c63087a8028..464b83bbe88 100644 --- a/pkg/commands/git_commands/branch.go +++ b/pkg/commands/git_commands/branch.go @@ -39,6 +39,15 @@ func (self *BranchCommands) NewWithoutTracking(name string, base string) error { return self.cmd.New(cmdArgs).Run() } +// NewWithoutCheckout creates a new branch without checking it out +func (self *BranchCommands) NewWithoutCheckout(name string, base string) error { + cmdArgs := NewGitCmd("branch"). + Arg(name, base). + ToArgv() + + return self.cmd.New(cmdArgs).Run() +} + // CreateWithUpstream creates a new branch with a given upstream, but without // checking it out func (self *BranchCommands) CreateWithUpstream(name string, upstream string) error { diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index d74174376f7..02d28704dcf 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -447,6 +447,7 @@ type KeybindingBranchesConfig struct { RebaseBranch string `yaml:"rebaseBranch"` RenameBranch string `yaml:"renameBranch"` MergeIntoCurrentBranch string `yaml:"mergeIntoCurrentBranch"` + MoveCommitsToNewBranch string `yaml:"moveCommitsToNewBranch"` ViewGitFlowOptions string `yaml:"viewGitFlowOptions"` FastForward string `yaml:"fastForward"` CreateTag string `yaml:"createTag"` @@ -882,6 +883,7 @@ func GetDefaultConfig() *UserConfig { RebaseBranch: "r", RenameBranch: "R", MergeIntoCurrentBranch: "M", + MoveCommitsToNewBranch: "N", ViewGitFlowOptions: "i", FastForward: "f", CreateTag: "T", diff --git a/pkg/gui/controllers/basic_commits_controller.go b/pkg/gui/controllers/basic_commits_controller.go index 9d3595a6189..cffb73b5d50 100644 --- a/pkg/gui/controllers/basic_commits_controller.go +++ b/pkg/gui/controllers/basic_commits_controller.go @@ -75,6 +75,17 @@ func (self *BasicCommitsController) GetKeybindings(opts types.KeybindingsOpts) [ GetDisabledReason: self.require(self.singleItemSelected()), Description: self.c.Tr.CreateNewBranchFromCommit, }, + { + // Putting this in BasicCommitsController even though we really only want it in the commits + // panel. But I find it important that this ends up next to "New Branch", and I couldn't + // find another way to achieve this. It's not such a big deal to have it in subcommits and + // reflog too, I'd say. + Key: opts.GetKey(opts.Config.Branches.MoveCommitsToNewBranch), + Handler: self.moveCommitsToNewBranch, + GetDisabledReason: self.canMoveCommitsToNewBranch, + Description: self.c.Tr.MoveCommitsToNewBranch, + Tooltip: self.c.Tr.MoveCommitsToNewBranchTooltip, + }, { Key: opts.GetKey(opts.Config.Commits.ViewResetOptions), Handler: self.withItem(self.createResetMenu), @@ -275,6 +286,14 @@ func (self *BasicCommitsController) newBranch(commit *models.Commit) error { return self.c.Helpers().Refs.NewBranch(commit.RefName(), commit.Description(), "") } +func (self *BasicCommitsController) moveCommitsToNewBranch() error { + return self.c.Helpers().Refs.MoveCommitsToNewBranch() +} + +func (self *BasicCommitsController) canMoveCommitsToNewBranch() *types.DisabledReason { + return self.c.Helpers().Refs.CanMoveCommitsToNewBranch() +} + func (self *BasicCommitsController) createResetMenu(commit *models.Commit) error { return self.c.Helpers().Refs.CreateGitResetMenu(commit.Hash) } diff --git a/pkg/gui/controllers/branches_controller.go b/pkg/gui/controllers/branches_controller.go index d22e56f1c9c..34b75b37757 100644 --- a/pkg/gui/controllers/branches_controller.go +++ b/pkg/gui/controllers/branches_controller.go @@ -58,6 +58,13 @@ func (self *BranchesController) GetKeybindings(opts types.KeybindingsOpts) []*ty Description: self.c.Tr.NewBranch, DisplayOnScreen: true, }, + { + Key: opts.GetKey(opts.Config.Branches.MoveCommitsToNewBranch), + Handler: self.moveCommitsToNewBranch, + GetDisabledReason: self.canMoveCommitsToNewBranch, + Description: self.c.Tr.MoveCommitsToNewBranch, + Tooltip: self.c.Tr.MoveCommitsToNewBranchTooltip, + }, { Key: opts.GetKey(opts.Config.Branches.CreatePullRequest), Handler: self.withItem(self.handleCreatePullRequest), @@ -763,6 +770,14 @@ func (self *BranchesController) newBranch(selectedBranch *models.Branch) error { return self.c.Helpers().Refs.NewBranch(selectedBranch.FullRefName(), selectedBranch.RefName(), "") } +func (self *BranchesController) moveCommitsToNewBranch() error { + return self.c.Helpers().Refs.MoveCommitsToNewBranch() +} + +func (self *BranchesController) canMoveCommitsToNewBranch() *types.DisabledReason { + return self.c.Helpers().Refs.CanMoveCommitsToNewBranch() +} + func (self *BranchesController) createPullRequestMenu(selectedBranch *models.Branch, checkedOutBranch *models.Branch) error { menuItems := make([]*types.MenuItem, 0, 4) diff --git a/pkg/gui/controllers/helpers/refs_helper.go b/pkg/gui/controllers/helpers/refs_helper.go index d30b35e19a8..ee20bae15dd 100644 --- a/pkg/gui/controllers/helpers/refs_helper.go +++ b/pkg/gui/controllers/helpers/refs_helper.go @@ -316,6 +316,77 @@ func (self *RefsHelper) NewBranch(from string, fromFormattedName string, suggest }) } +func (self *RefsHelper) MoveCommitsToNewBranch() error { + currentBranch := self.c.Model().Branches[0].Name + prompt := utils.ResolvePlaceholderString( + self.c.Tr.NewBranchNameBranchOff, + map[string]string{ + "branchName": currentBranch, + }, + ) + + return self.c.Prompt(types.PromptOpts{ + Title: prompt, + HandleConfirm: func(response string) error { + self.c.LogAction(self.c.Tr.MoveCommitsToNewBranch) + newBranchName := SanitizedBranchName(response) + if err := self.c.Git().Branch.NewWithoutCheckout(newBranchName, "HEAD"); err != nil { + return err + } + + mustStash := IsWorkingTreeDirty(self.c.Model().Files) + if mustStash { + if err := self.c.Git().Stash.Push(self.c.Tr.StashPrefix + currentBranch); err != nil { + return err + } + } + + if err := self.c.Git().Commit.ResetToCommit("@{u}", "hard", []string{}); err != nil { + return err + } + + if err := self.c.Git().Branch.Checkout(newBranchName, git_commands.CheckoutOptions{}); err != nil { + return err + } + + if mustStash { + if err := self.c.Git().Stash.Pop(0); err != nil { + return err + } + } + + self.c.Contexts().LocalCommits.SetSelection(0) + self.c.Contexts().Branches.SetSelection(0) + + return self.c.Refresh(types.RefreshOptions{Mode: types.BLOCK_UI, KeepBranchSelectionIndex: true}) + }, + }) +} + +func (self *RefsHelper) CanMoveCommitsToNewBranch() *types.DisabledReason { + if len(self.c.Model().Branches) == 0 { + return &types.DisabledReason{Text: self.c.Tr.NoBranchesThisRepo} + } + currentBranch := self.c.Model().Branches[0] + if !currentBranch.Head { + panic("We rely on the first branch being the current branch") + } + if currentBranch.DetachedHead { + return &types.DisabledReason{Text: self.c.Tr.CannotMoveCommitsFromDetachedHead, ShowErrorInPanel: true} + } + if !currentBranch.RemoteBranchStoredLocally() { + return &types.DisabledReason{Text: self.c.Tr.CannotMoveCommitsNoUpstream, ShowErrorInPanel: true} + } + if currentBranch.IsBehindForPull() { + return &types.DisabledReason{Text: self.c.Tr.CannotMoveCommitsBehindUpstream, ShowErrorInPanel: true} + } + if !currentBranch.IsAheadForPull() { + return &types.DisabledReason{Text: self.c.Tr.CannotMoveCommitsNoUnpushedCommits, ShowErrorInPanel: true} + } + + return nil +} + // SanitizedBranchName will remove all spaces in favor of a dash "-" to meet // git's branch naming requirement. func SanitizedBranchName(input string) string { diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index aa88d397a97..38b663fd1d5 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -125,6 +125,12 @@ type TranslationSet struct { CheckoutTypeDetachedHeadTooltip string NewBranch string NewBranchFromStashTooltip string + MoveCommitsToNewBranch string + MoveCommitsToNewBranchTooltip string + CannotMoveCommitsFromDetachedHead string + CannotMoveCommitsNoUpstream string + CannotMoveCommitsBehindUpstream string + CannotMoveCommitsNoUnpushedCommits string NoBranchesThisRepo string CommitWithoutMessageErr string Close string @@ -1105,6 +1111,12 @@ func EnglishTranslationSet() *TranslationSet { CheckoutTypeDetachedHeadTooltip: "Checkout the remote branch as a detached head, which can be useful if you just want to test the branch but not work on it yourself. You can still create a local branch from it later.", NewBranch: "New branch", NewBranchFromStashTooltip: "Create a new branch from the selected stash entry. This works by git checking out the commit that the stash entry was created from, creating a new branch from that commit, then applying the stash entry to the new branch as an additional commit.", + MoveCommitsToNewBranch: "Move commits to new branch", + MoveCommitsToNewBranchTooltip: "Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.\n\nNote that this disregards the selection, the new branch is always created from the tip of the current branch.", + CannotMoveCommitsFromDetachedHead: "Cannot move commits from a detached head", + CannotMoveCommitsNoUpstream: "Cannot move commits from a branch that has no upstream branch", + CannotMoveCommitsBehindUpstream: "Cannot move commits from a branch that is behind its upstream branch", + CannotMoveCommitsNoUnpushedCommits: "There are no unpushed commits to move to a new branch", NoBranchesThisRepo: "No branches for this repo", CommitWithoutMessageErr: "You cannot commit without a commit message", Close: "Close", diff --git a/pkg/integration/tests/branch/move_commits_to_new_branch.go b/pkg/integration/tests/branch/move_commits_to_new_branch.go new file mode 100644 index 00000000000..2372b008ffc --- /dev/null +++ b/pkg/integration/tests/branch/move_commits_to_new_branch.go @@ -0,0 +1,56 @@ +package branch + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var MoveCommitsToNewBranch = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Create a new branch from the commits that you accidentally made on the wrong branch", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.EmptyCommit("initial commit") + shell.CloneIntoRemote("origin") + shell.PushBranchAndSetUpstream("origin", "master") + shell.CreateFileAndAdd("file1", "file1 content") + shell.Commit("new commit 1") + shell.EmptyCommit("new commit 2") + shell.UpdateFile("file1", "file1 changed") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Files(). + Lines( + Contains("M file1"), + ) + t.Views().Branches(). + Focus(). + Lines( + Contains("master ↑2").IsSelected(), + ). + Press(keys.Branches.MoveCommitsToNewBranch) + + t.ExpectPopup().Prompt(). + Title(Equals("New branch name (branch is off of 'master')")). + Type("new branch"). + Confirm() + + t.Views().Branches(). + Lines( + Contains("new-branch").IsSelected(), + Contains("master ✓"), + ) + + t.Views().Commits(). + Lines( + Contains("new commit 2").IsSelected(), + Contains("new commit 1"), + Contains("initial commit"), + ) + t.Views().Files(). + Lines( + Contains("M file1"), + ) + }, +}) diff --git a/pkg/integration/tests/branch/move_commits_to_new_branch_no_upstream.go b/pkg/integration/tests/branch/move_commits_to_new_branch_no_upstream.go new file mode 100644 index 00000000000..c85233700fd --- /dev/null +++ b/pkg/integration/tests/branch/move_commits_to_new_branch_no_upstream.go @@ -0,0 +1,31 @@ +package branch + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var MoveCommitsToNewBranchNoUpstream = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Moving commits to a new branch is not allowed when the current branch has no upstream branch", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.EmptyCommit("initial commit") + shell.EmptyCommit("new commit 1") + shell.EmptyCommit("new commit 2") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Branches(). + Focus(). + Lines( + Contains("master").IsSelected(), + ). + Press(keys.Branches.MoveCommitsToNewBranch) + + t.ExpectPopup().Alert(). + Title(Equals("Error")). + Content(Contains("Cannot move commits from a branch that has no upstream branch")). + Confirm() + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index de074232f17..550bee66853 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -43,6 +43,8 @@ var tests = []*components.IntegrationTest{ branch.Delete, branch.DeleteRemoteBranchWithCredentialPrompt, branch.DetachedHead, + branch.MoveCommitsToNewBranch, + branch.MoveCommitsToNewBranchNoUpstream, branch.NewBranchFromRemoteTrackingDifferentName, branch.NewBranchFromRemoteTrackingSameName, branch.OpenPullRequestNoUpstream, diff --git a/schema/config.json b/schema/config.json index 28318ddd60d..456a7376278 100644 --- a/schema/config.json +++ b/schema/config.json @@ -1464,6 +1464,10 @@ "type": "string", "default": "M" }, + "moveCommitsToNewBranch": { + "type": "string", + "default": "N" + }, "viewGitFlowOptions": { "type": "string", "default": "i"