-
Notifications
You must be signed in to change notification settings - Fork 19
Add --fetch flag to delete command #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
069f7eb
39b9fb8
25572ef
302d2a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,12 @@ The delete operation removes the specified topic branch from the local repositor | |
| **--no-remote** | ||
| : Don't delete the remote tracking branch (default behavior) | ||
|
|
||
| **--fetch** | ||
| : Fetch from remote before deleting. This updates local refs so that Git can correctly detect whether the branch has been merged remotely (e.g., via a GitHub PR merge). | ||
|
|
||
| **--no-fetch** | ||
| : Don't fetch from remote before deleting (overrides config) | ||
|
|
||
| ## SAFETY CHECKS | ||
|
|
||
| By default, Git prevents deletion of branches with unmerged changes. The delete command: | ||
|
|
@@ -67,6 +73,13 @@ Delete with remote cleanup: | |
| git flow feature delete my-feature --remote | ||
| ``` | ||
|
|
||
| ### Fetch Before Delete | ||
|
|
||
| Fetch and fast-forward the parent branch before deleting, so Git can detect branches merged remotely (e.g., via a GitHub PR merge): | ||
| ```bash | ||
| git flow feature delete my-feature --fetch | ||
| ``` | ||
|
Comment on lines
+76
to
+81
|
||
|
|
||
| ### Force Deletion | ||
|
|
||
| Delete branch with unmerged changes: | ||
|
|
@@ -144,6 +157,12 @@ git config gitflow.hotfix.delete.force true | |
| git config gitflow.branch.feature.deleteRemote true | ||
| ``` | ||
|
|
||
| ### Fetch Settings | ||
| ```bash | ||
| # Always fetch before deleting feature branches | ||
| git config gitflow.feature.delete.fetch true | ||
| ``` | ||
|
|
||
| ## SAFETY CONSIDERATIONS | ||
|
|
||
| **Unmerged Changes** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -455,6 +455,11 @@ The finish command supports extensive merge strategy configuration through comma | |
| : *Type*: boolean | ||
| : *Default*: true | ||
|
|
||
| **gitflow.*type*.delete.fetch** | ||
| : Fetch and fast-forward the parent branch before deleting a topic branch. When enabled, updates the parent branch so that Git can correctly detect whether the topic branch has been merged remotely (e.g., via a GitHub PR merge). | ||
| : *Type*: boolean | ||
| : *Default*: false | ||
|
|
||
|
Comment on lines
+458
to
+462
|
||
| ### Merge Message Options | ||
|
|
||
| **gitflow.*type*.finish.mergemessage** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current
--fetchimplementation only runsgit fetch <remote>, which updates remote-tracking refs but does not update the local base branch (e.g.,develop). Since deletion still relies ongit branch -d/-D(merge check against local refs), fetching alone will not change whether Git considers the branch “fully merged”, so this likely won’t resolve the remotely-merged-PR scenario described in the PR/Issue #88.To make
--fetchachieve the intended behavior, consider checking merge status against the remote-tracking base (e.g.,refs/remotes/<remote>/<parent>) after fetching and, when it’s merged there, proceed with a safe force-delete (or an explicit, well-documented alternative).