1Feature: git town-kill: killing the current feature branch with child branches 2 3 As a user killing the current feature branch that has child branches 4 I want that the current branch is cleanly removed from the branch hierarchy metadata 5 So that killing branches is robust and reliable. 6 7 8 Background: 9 Given my repo has a feature branch named "feature-1" 10 And my repo has a feature branch named "feature-2" as a child of "feature-1" 11 And my repo has a feature branch named "feature-3" as a child of "feature-2" 12 And the following commits exist in my repo 13 | BRANCH | LOCATION | MESSAGE | 14 | feature-1 | local, remote | feature 1 commit | 15 | feature-2 | local, remote | feature 2 commit | 16 | feature-3 | local, remote | feature 3 commit | 17 And I am on the "feature-2" branch 18 And my workspace has an uncommitted file 19 When I run "git-town kill" 20 21 22 Scenario: result 23 Then it runs the commands 24 | BRANCH | COMMAND | 25 | feature-2 | git fetch --prune --tags | 26 | | git push origin :feature-2 | 27 | | git add -A | 28 | | git commit -m "WIP on feature-2" | 29 | | git checkout feature-1 | 30 | feature-1 | git branch -D feature-2 | 31 And I end up on the "feature-1" branch 32 And my repo doesn't have any uncommitted files 33 And the existing branches are 34 | REPOSITORY | BRANCHES | 35 | local | main, feature-1, feature-3 | 36 | remote | main, feature-1, feature-3 | 37 And my repo now has the following commits 38 | BRANCH | LOCATION | MESSAGE | 39 | feature-1 | local, remote | feature 1 commit | 40 | feature-3 | local, remote | feature 3 commit | 41 And Git Town is now aware of this branch hierarchy 42 | BRANCH | PARENT | 43 | feature-1 | main | 44 | feature-3 | feature-1 | 45 46 47 Scenario: undoing the kill 48 When I run "git-town undo" 49 Then it runs the commands 50 | BRANCH | COMMAND | 51 | feature-1 | git branch feature-2 {{ sha 'WIP on feature-2' }} | 52 | | git checkout feature-2 | 53 | feature-2 | git reset {{ sha 'feature 2 commit' }} | 54 | | git push -u origin feature-2 | 55 And I end up on the "feature-2" branch 56 And my workspace has the uncommitted file again 57 And the existing branches are 58 | REPOSITORY | BRANCHES | 59 | local | main, feature-1, feature-2, feature-3 | 60 | remote | main, feature-1, feature-2, feature-3 | 61 And my repo is left with my original commits 62 And Git Town is now aware of this branch hierarchy 63 | BRANCH | PARENT | 64 | feature-1 | main | 65 | feature-2 | feature-1 | 66 | feature-3 | feature-2 | 67