Question

I am working in local with git and my remote repository is svn so I use the "git svn" script to interract with the distant repo.

On the repo there is a "trunk" who correspond to my git "master", no problem. There are also different branches which refer to various states of stability of the project, here I will just take one and refer to it as "candidate_vX.Y". I have local git aliases for this svn branches, which is basically "candidate".

Now since candidate_v10.2 had been put in production, a branch for v11.0 had been made on the trunk which was candidate_v11.0 and I needed to redefine my local git alias to make it point to the new branch. I simply applied an internal documentation, which told me to do:

git symbolic-ref refs/heads/candidate_v11.0 refs/heads/candidate

But I realized afterwards that it was a mistake, the documentation of symbolic-refs says

git symbolic-ref [-m <reason>] <name> <ref>

and I did the opposite, so how to undo that?

Was it helpful?

Solution

After a few hours browsing the web and not founding anything, I came to the following answer. Since I am pretty new to git, I hope there will be some gurus to downvote and give a more elegant solution, but at least this should work for anybody having a similar problem:

I made a

find .git/refs

and got a list of all my refs. Then I used 'cat' to check which every ref points to, and I had *.git/refs/heads/BR_C_01.11.00* pointing to .git/refs/heads/candidate pointing to *.git/refs/heads/BR_C_01.10.00*

so I just deleted the .git/refs/heads/BR_C_01.11.00 file and made the operation again with the correct command. I am pretty aware this is highly unsafe editing git file system by hand, but could not find a simple command to do this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top