Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Stray `main` tag makes `git pull origin main` a silent no-op (tag shadows branch)

Open Beginner friendly
#213 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
git, rust
Domain
release

Research direction

The issue identifies the accidental main tag and gives the proposed deletion command git push origin :refs/tags/main. Check the repository’s tag list and confirm that the main tag is the one described, then remove it. Verify that git fetch --dry-run origin main resolves to the branch afterward.

Written by the indexing model from the issue text.

Description

Summary

refs/tags/main (lightweight, → 0b3b528, #44) coexists with refs/heads/main. Git resolves an unqualified refspec by matching refs/tags/<name> before refs/heads/<name> (count_refspec_match() in remote.c), so the very common

git pull origin main

fetches the tag instead of the branch, then merges/rebases onto the tag's old commit. The command still exits 0, so the failure is silent: the checkout never updates.

Reproduction (against 0be7a76)

$ git fetch --dry-run origin main
 * tag               main       -> FETCH_HEAD        # expected: branch

$ git pull --rebase origin main
 * tag               main       -> FETCH_HEAD
Already up to date.                                   # exit 0, branch unchanged

A fully qualified refspec behaves correctly:

$ git fetch --dry-run origin refs/heads/main
 * branch            main       -> FETCH_HEAD

Impact

Every client that passes the short branch name to git pull — GUI clients such as UGit do exactly git pull --recurse-submodules origin main, and so do many scripts — silently stops receiving updates. Worse, with pull.rebase=true the local branch can be moved backwards to 0b3b528: rebasing onto an ancestor of HEAD is reported as "already up to date", so the commits above it are dropped from the branch.

We hit precisely this: local main was rewound one commit, and three consecutive pull attempts returned success without applying the ~105 upstream commits. git fetch without a refspec was equally stale, because the branch half of the pull never ran.

git pull with no arguments is unaffected (it resolves branch.<name>.merge rather than matching a remote ref by name), which makes the problem easy to misdiagnose.

Suggested fix

Delete the stray tag — every other tag in this repository follows v*, so main looks accidental:

git push origin :refs/tags/main

(or Releases → Tags → main → Delete in the GitHub UI).

Workaround for affected clients until then

git pull --rebase origin refs/heads/main

Reproduced with git 2.45.2.windows.1 on Windows.

Dominant language
Rust
Stars
3.5k
Forks
140
Avg merge
15h 32m
Merged PRs (30d)
27

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/tgrep

All issues in microsoft/tgrep

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.