Skip to content

Git reset does not work properly when a tag and branch share name #4569

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

Open
ChrisMcD1 opened this issue May 19, 2025 · 0 comments · May be fixed by #4571
Open

Git reset does not work properly when a tag and branch share name #4569

ChrisMcD1 opened this issue May 19, 2025 · 0 comments · May be fixed by #4571
Labels
bug Something isn't working

Comments

@ChrisMcD1
Copy link
Contributor

Describe the bug
When you have a tag and branch with the same name (foobar) in my case, you cannot press g h on the branches tab to reset to the foobar branch.

To Reproduce

git init
git commit --allow-empty -m "Commit 1"
git tag foobar -m ""
git commit --allow-empty -m "Commit 2"
git branch -c foobar
git commit --allow-empty -m "Commit 3"

Launch LazyGit
Pres g h on branch foobar

Expected behavior
Expect to go to "Commit 2", and you actually go to "Commit 1"

Screenshots
If applicable, add screenshots to help explain your problem.

Version info:
Built off of latest master a0ec22c251c6
git version 2.49.0

Additional context
I'll put a fix in for this shortly, just documenting here for posterity. I'm assuming we just need to make our reset command use a slightly more specific name that disambiguates the two.
From the debug logs, it seems we just run a git reset --hard foobar. I imagine we'll just need to do a git reset --hard refs/heads/foobar as the fix.

@ChrisMcD1 ChrisMcD1 added the bug Something isn't working label May 19, 2025
@ChrisMcD1 ChrisMcD1 changed the title Git reset does not work properly when a tag and branch share nam Git reset does not work properly when a tag and branch share name May 19, 2025
@ChrisMcD1 ChrisMcD1 linked a pull request May 19, 2025 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant