Skip to content

bug: git town ship fails if branch name is the same as a directory #5657

@derekspelledcorrectly

Description

@derekspelledcorrectly

Steps to reproduce

If you have a directory with the same name as the branch, git town ship fails:

Steps to Reproduce

  1. Clone derekspelledcorrectly/gt-bug
  2. Checkout branch test
  3. git town ship

Command output

❯ git town ship --verbose

(verbose) git version
git version 2.51.0

(verbose) git rev-parse --show-toplevel
/Users/a/Development/gt-bug

(verbose) git config -lz --global
push.default
simple

rebase.autostash
true

core.excludesfile
~/.config/git/ignore

tag.sort
version:refname

http.cookiefile
~/.config/git/cookies

[email protected]:.insteadof
https://github.com/

diff.renames
copy

merge.ff
only

merge.conflictstyle
zdiff3

difftool.prompt
false

mergetool.keeptemporaries
false

mergetool.prompt
false

mergetool.keepbackup
false

init.defaultbranch
main

pull.rebase
true

git-town.offline
false


(verbose) git config -lz --local
core.repositoryformatversion
0

core.filemode
true


core.bare
false

core.logallrefupdates
true

core.ignorecase
true

core.precomposeunicode
true

remote.origin.url
[email protected]:derekspelledcorrectly/gt-bug.git

remote.origin.fetch
+refs/heads/*:refs/remotes/origin/*

branch.main.remote
origin

branch.main.merge
refs/heads/main

branch.main.rebase
true

git-town-branch.test.branchtype
feature

git-town-branch.test.parent
main

git-town.github-connector
gh


(verbose) git config -lz
credential.helper
osxkeychain

[email protected]:squareup.insteadof
https://github.com/squareup

tag.sort
version:refname

http.cookiefile
~/.config/git/cookies

[email protected]:.insteadof
https://github.com/

diff.renames
copy

init.defaultbranch
main

pull.rebase
true

git-town.offline
false


core.repositoryformatversion
0

core.filemode
true


core.bare
false

core.logallrefupdates
true

core.ignorecase
true

core.precomposeunicode
true

remote.origin.url
[email protected]:derekspelledcorrectly/gt-bug.git

remote.origin.fetch
+refs/heads/*:refs/remotes/origin/*

branch.main.remote
origin

branch.main.merge
refs/heads/main

branch.main.rebase
true

git-town-branch.test.branchtype
feature

git-town-branch.test.parent
main

git-town.github-connector
gh

Git Town 22.0.0
OS: darwin
Darwin BLKHXJ1GC9GFT.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:30 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6020 arm64

(verbose) git status -z --ignore-submodules

(verbose) git rev-parse --verify -q MERGE_HEAD

(verbose) git rev-parse --absolute-git-dir
/Users/a/Development/gt-bug/.git

(verbose) git remote get-url origin
[email protected]:derekspelledcorrectly/gt-bug.git

(verbose) git remote
origin

(verbose) git branch --show-current
test

[test] git fetch --prune --tags

(verbose) git stash list

(verbose) git for-each-ref "--format=refname:%(refname) branchname:%(refname:lstrip=2) sha:%(objectname) head:%(if)%(HEAD)%(then)Y%(else)N%(end) worktree:%(if)%(worktreepath)%(then)Y%(else)N%(end) symref:%(if)%(symref)%(then)Y%(else)N%(end) upstream:%(upstream:lstrip=2) track:%(upstream:track,nobracket)" --sort=refname refs/heads/ refs/remotes/
refname:refs/heads/main branchname:main sha:869903ac89af4cc3c695d01a069f03dd7c14308f head:N worktree:N symref:N upstream:origin/main track:
refname:refs/heads/test branchname:test sha:8942831aa18ee13d9aeec3d255f827df0f0b424e head:Y worktree:Y symref:N upstream: track:
refname:refs/remotes/origin/HEAD branchname:origin/HEAD sha:869903ac89af4cc3c695d01a069f03dd7c14308f head:N worktree:N symref:Y upstream: track:
refname:refs/remotes/origin/main branchname:origin/main sha:869903ac89af4cc3c695d01a069f03dd7c14308f head:N worktree:N symref:N upstream: track:

(verbose) git rev-parse --verify --abbrev-ref @{-1}
main

(verbose) git shortlog -s -n -e main..test
     2	<[email protected]>

(verbose) git diff --shortstat main test
fatal: ambiguous argument 'test': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

(verbose) git for-each-ref "--format=refname:%(refname) branchname:%(refname:lstrip=2) sha:%(objectname) head:%(if)%(HEAD)%(then)Y%(else)N%(end) worktree:%(if)%(worktreepath)%(then)Y%(else)N%(end) symref:%(if)%(symref)%(then)Y%(else)N%(end) upstream:%(upstream:lstrip=2) track:%(upstream:track,nobracket)" --sort=refname refs/heads/ refs/remotes/
refname:refs/heads/main branchname:main sha:869903ac89af4cc3c695d01a069f03dd7c14308f head:N worktree:N symref:N upstream:origin/main track:
refname:refs/heads/test branchname:test sha:8942831aa18ee13d9aeec3d255f827df0f0b424e head:Y worktree:Y symref:N upstream: track:
refname:refs/remotes/origin/HEAD branchname:origin/HEAD sha:869903ac89af4cc3c695d01a069f03dd7c14308f head:N worktree:N symref:Y upstream: track:
refname:refs/remotes/origin/main branchname:origin/main sha:869903ac89af4cc3c695d01a069f03dd7c14308f head:N worktree:N symref:N upstream: track:

(verbose) git config -lz --global
branch.autosetuprebase
remote

push.default
simple

rebase.autostash
true

core.excludesfile
~/.config/git/ignore

tag.sort
version:refname

http.cookiefile
~/.config/git/cookies

[email protected]:.insteadof
https://github.com/

diff.renames
copy

merge.ff
only

merge.conflictstyle
zdiff3

difftool.prompt
false

mergetool.keeptemporaries
false

mergetool.prompt
false

mergetool.keepbackup
false

init.defaultbranch
main

pull.rebase
true

git-town.offline
false


(verbose) git config -lz --local
core.repositoryformatversion
0

core.filemode
true


core.bare
false

core.logallrefupdates
true

core.ignorecase
true

core.precomposeunicode
true

remote.origin.url
[email protected]:derekspelledcorrectly/gt-bug.git

remote.origin.fetch
+refs/heads/*:refs/remotes/origin/*

branch.main.remote
origin

branch.main.merge
refs/heads/main

branch.main.rebase
true

git-town-branch.test.branchtype
feature

git-town-branch.test.parent
main

git-town.github-connector
gh


(verbose) git stash list

Error: cannot determine if branch "cannot determine if branch %q has unmerged commits: %w" has unmerged commits: %!w(gitdomain.LocalBranchName=test)%!(EXTRA *fmt.wrapError=
----------------------------------------
Diagnostic information of failed command

COMMAND: git diff --shortstat main test
ERROR: exit status 128
OUTPUT START
fatal: ambiguous argument 'test': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

OUTPUT END
----------------------------------------)
Auto-undo...


(verbose) git stash list

Error: the branch "test" has no shippable changes

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions