I have this situation:
I have two repositories on my machine, both are based on the same original repository.
But the other one has a branch I would like to copy to the other (I created it on that other repo and did lots of changes). Reason for this is that the second repo is in the Eclipse workspace and includes my “current” work.
I have tried creating a remote repo:
[remote "other"]
fetch = +refs/heads/*:refs/remotes/other/*
url = /home/me/src/other
It shows up with git remote:
$:~/src/prod$ git remote
other
origin
But if I try to access that branch with e.g.
git branch --track other_branch other/branch
I get
fatal: Not a valid object name: 'other/branch'.
That branch does exist, I have verified with “git branch”.
So what’s wrong?
I also tried adding this to .git/config with
[branch "branch"]
remote = other
merge = refs/heads/other_branch
But the branch won’t show up with “git branch -r”.
If you haven’t contacted the remote repository git doesn’t know about
other/branchbranch, so it complains about it. Just fetch the repository state with