Skip to content

Add fetch option for topic branch finish #18

@alexrinass

Description

@alexrinass

Add support for fetching from remote before finishing a topic branch, which ensures the latest remote changes are incorporated in the merge.

  • Add command line options to control fetching before branch finish:
    • --fetch - Fetch from remote before finishing branch
    • --no-fetch - Explicitly disable fetching
  • Ensure the git config setting is respected for each topic branch type individually
    • Generic key: gitflow.<topic>.finish.fetch
    • Examples: gitflow.feature.finish.fetch, gitflow.release.finish.fetch, gitflow.hotfix.finish.fetch
  • When fetch is enabled, perform a git fetch operation on the relevant remote before merging the branch
    • Example: git fetch <remote> before executing the merge and cleanup operations
  • Default to no-fetch when config setting is not present
  • Update documentation to reflect the new option
  • Add tests to verify the option works correctly for each branch type
  • For testing purposes, you can use another local bare repo as “remote” by using its file URL

Test Cases:

  1. Default Behavior (No Fetch)

    • Create changes on remote that aren't in the local repo
    • Finish a branch without specifying fetch option
    • Expected: Branch is finished based on local state, without remote changes
    • Verify merge doesn't include the remote changes
  2. Fetch with Command Line (Positive)

    • Create changes on remote that aren't in the local repo
    • Test with command line: git flow feature finish myfeature --fetch
    • Expected: Fetch occurs before finishing the branch
    • Verify merge includes the latest remote changes
  3. Fetch with Command Line (Negative)

    • Create changes on remote that aren't in the local repo
    • Set config: gitflow.feature.finish.fetch=true
    • Test with command line: git flow feature finish myfeature --no-fetch
    • Expected: No fetch occurs despite config setting
    • Verify merge doesn't include the remote changes
  4. Fetch with Config

    • Create changes on remote that aren't in the local repo
    • Set config: gitflow.feature.finish.fetch=true
    • Finish a branch without specifying fetch option
    • Expected: Fetch occurs before finishing the branch
    • Verify merge includes the latest remote changes
  5. Cross-Branch Type Tests

    • Verify fetch works correctly for feature, release, and hotfix branches
    • Test both positive and negative command line options
    • Test with different configs for each branch type

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions