AeroCross
AeroCross

Reputation: 4319

Remove a tracking from a git branch

I have a "feature/admin" branch that is tracking multiple branches (origin/feature/admin and development, the latter being local) - I want to remove the local tracking (so my local branch only tracks the remote branch origin/feature/admin).

I've tried removing it with git branch -dr development, but...

error: remote branch 'development' not found.

Any suggestions?

Upvotes: 2

Views: 2388

Answers (2)

AeroCross
AeroCross

Reputation: 4319

I found the answer to this little dilemma.

In the Git Config file of the repo, I deleted these two lines (using Gity):

Keys:

branch.feature/admin.remote
branch.feature/admin.merge

Values:

.
refs/heads/development

(respectively)

That removed the local tracking. I'm guessing the "." indicates local.

Upvotes: 2

larsks
larsks

Reputation: 312028

The name "development" isn't a remote branch, since it doesn't include the name of a remote. Take a look at the output of git branch -a:

* develop
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/develop
  remotes/origin/master

The remote branches all start with the remotes/ prefix. So to delete the remote "develop" branch, I would run:

git branch -dr origin/develop

Although, having done this, the branch will come back next time I do a git pull.

Upvotes: 0

Related Questions