Undoing forced push: how to update remote ref with specific remote revision
There is a common situation - forced updating of remote branch with losing
some revisions from it:
$ git push --force origin
Counting objects: 19, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (12/12), 2.27 KiB, done.
Total 12 (delta 8), reused 0 (delta 0)
remote: => Syncing... [OK]
To git@gitserver.com:path/to/project.git
C..B master -> master
In other words, before the pushing remote master was like A---B---C and
forcing update changed it to A---B.
C revision is remote only - it exists on git-server and on the working
station of it's author. It means that there is no such local ref C.
Question 1: is there a way to set remote master to C revision?
I've tried to update it with push --force again like the answer for
similar question offers, but it allows to use only local refs:
$ git push --force origin C:master
error: src refspec C does not match any.
error: failed to push some refs to 'git@gitserver.com:path/to/project.git'
So if I'm getting it right the whole problem is to retrieve this revision
from git server.
Question 2: is there a way to fetch remote revision that doesn't belong to
any branch?
PS: let's think that there is no ssh access to git server, it means that
there is no way to manipulate git from the server side.
No comments:
Post a Comment