On Mon, 9 May 2016 12:30:39 -0700 (PDT)
Joshua Hoblitt <j...@hoblitt.com> wrote:

> Is it possible to fetch all refs/tags and prune refs/tags with a
> single CLI command or are two porcelain invocations required?
> It was thought that a solution to this had been found but example
> below does not work when the currently checked out ref is removed
> from the remote.
> $ git fetch -fup origin +refs/heads/*:refs/heads/*
>   refs/tags/*:refs/tags/*
>   x [deleted]         (none)     -> tickets/DM-5320
> $ git fetch --prune
>  x [deleted]         (none)     -> origin/tickets/DM-5320

Well, I'm not really sure how to approach your problem as it appears
you might not possess a clear picture of what happens in your

The first thing to note is that the refspec


tells Git to grab all head refs (branches) from the remote repository
and overwrite using them any matching *local* branches in your
repository, as well as create those local branches which exists in the
remote repo but do not exist in the local one.
Let me reiterate: this refspec targets your true local branches,
not remote-tracking branches (which are "namespaced" under the name of
your remote, like "refs/remotes/origin/*".

Now, looking at your second Git invocation I suspect you
remote-tracking branches in your repository, too.

So I think you should stop and think about your current setup: if you
use direct force-updating of the local branches from the remote repo,
it looks like you don't need remote-tracking branches at all.

If yes, then supposedly you have your remote added in a wrong way (or
auto-created for you in a wrong way when you did `git clone`).
The way to go would be to re-add it using the

  git remote remove origin
  git remote add --mirror=fetch origin

and then use `git fetch` with the "-u" command-line option and have in
mind what happens if you're updating a branch which is currently
checked out in your repository.  I've explained this stuff to someone
at [1] so you might consider reading it.

If you still need the remote-tracking branches then please consider
explaining in more clear terms how exactly direct force-updating of the
local branches should play with the remote-tracking branches in your

1. http://stackoverflow.com/a/33651102/720999

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to