How do I stop TortoiseGit from pulling every single branch I've ever checked out locally?

625 views
Skip to first unread message

skr...@gmail.com

unread,
Feb 12, 2015, 6:51:56 PM2/12/15
to tortoise...@googlegroups.com
I have a repo on GitHub, and I'm using TortoiseGit 1.8.something.

Whenever I do a pull in TortoiseGit, it pulls every single branch that I've ever checked out locally (several hundreds by now), and correctly concludes that they're all "= [up to date]", except the latest ones that actually matter.

Why does it pull branches that I no longer have checked out locally?

If I open the Switch/Checkout dialog I only see a small number of local branches, because I've used the Browse References dialog many times to remove local branches that were merged to master long ago. But why don't they disappear from the list of branches that gets updated on a pull?

If I check Prune in the Pull dialog, it removes the tracking (?) on branches that I had checked out locally but which are now deleted from the origin, but what I want is the reverse of that? I'm not sure about what the git terminology is for the thing I'm asking for either, which makes it very hard to search for.

The output in the Pull dialog looks like this:


git.exe pull -v --no-rebase --progress "origin"

From something.git.hub.com:some/repo
= [up to date]      master     -> origin/master
= [up to date]      branch1   -> origin/branch1
....
= [up to date]      branch4711 -> origin/branch4711
Already up-to-date.

Success (1685 ms @ 2015-02-12 15:47:46)


--
/Henrik

Yue Lin Ho

unread,
Feb 12, 2015, 9:53:47 PM2/12/15
to tortoise...@googlegroups.com, skr...@gmail.com
Hi Henrik:

skr...@gmail.com於 2015年2月13日星期五 UTC+8上午7時51分56秒寫道:
^_^
I don't quite understand what pull exactly does.
But, I know "pull = fetch + merge" in generally.

In my opinion, pull is a little complex and the result is not always what I want.
So, in my daily work, I use fetch command, then look into log and do what I really need.
(Thus, I am not annoyed by those questions.)

If you really want to pull single branch, such as master:
1. checkout master branch
2. use the "Arbitrary URL" in Pull dialog. (Please see attached file.)

If you really need the answers for your questions, let me know.
I will try to find them out. :)

Yue Lin Ho

 
pull.png

Henrik Schröder

unread,
Feb 13, 2015, 1:14:07 PM2/13/15
to Yue Lin Ho, tortoise...@googlegroups.com
Fetch through Tortoisegit does the exact same thing. A bit of testing with the command-line shows that it's the "-v" option to fetch and pull that TortoiseGit automatically adds that makes it print verbose what it is doing, and that causes me to see that it actually fetches every single branch I've ever checked out locally.

So this is not specific to TortoiseGit, this is specific to git itself.

However, I'm going a bit crazy trying to figure out where git stores this list of branches to fetch. If I look in .git/info/refs, I find a list of *every* remote branch, so this isn't it.

.git/refs/remote/origin contains a bunch of files that does not correspond to the local branches I have, it contains a few more, but it's close.

.git/logs/refs/remote/origin - BINGO!

Seems like git reflog expire is the command I'm looking for. Thank you rubber duck mailing list, and let's hope this gets archived and searchable for the next guy going crazy like me. :-)


--
/Henrik

Yue Lin Ho

unread,
Feb 13, 2015, 8:02:01 PM2/13/15
to tortoise...@googlegroups.com, yueli...@gmail.com, skr...@gmail.com

Here is some ref.


(the section "Fetching and Pulling from Your Remotes")


Henrik Schröder於 2015年2月14日星期六 UTC+8上午2時14分07秒寫道:
Reply all
Reply to author
Forward
0 new messages