On one particular repo, when I run
git fetch
It does all the stuff it's supposed to do, but also reports:
* [new branch] Story/abc-123 -> origin/Story/abc-123
every single time.
if I run git branch -r | grep abc-123, it yields:
origin/story/abc-123
Note that in the output from the fetch, 'Story' is capitalized, but in the branch -r output it is not. The problem seems to be local. I don't have this issue if I make a new clone of the repo elsewhere, but I'd rather not go down this road if I can avoid it.
Is there any way to make it stop doing this?
fetch will not update local branches (which track remote branches); if you want to update your local branches you still need to pull every branch. fetch will not create local branches (which track remote branches), you have to do this manually.
git fetch is the command that tells your local git to retrieve the latest meta-data info from the original (yet doesn't do any file transferring. It's more like just checking to see if there are any changes available). git pull on the other hand does that AND brings (copy) those changes from the remote repository.
On its own, git fetch updates all the remote tracking branches in local repository. No changes are actually reflected on any of the local working branches.
git pull is one of the 4 remote operations within Git. Without running git pull , your local repository will never be updated with changes from the remote. git pull should be used every day you interact with a repository with a remote, at the minimum.
The problem here is that your ./git/refs
directory is in a different case for part of the branch name compared to the actual remote. I.e., git branch thinks the branch is lower case:
$git branch
...
origin/story/abc-123
...
But your copy of the refs thinks the story directory is upper case:
$ls .git/refs/remotes/origin
...
Story
...
Apparently you can just delete the entire refs directory and git will regenerate it, but because I was a coward I just fixed it by renaming the offending directory:
mv .git/refs/remotes/origin/Story .git/refs/remotes/origin/story
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With