git - How to reset the origin/master ref locally -
i have following scenario:
i have 3 commits in local repo, this:
initial -- -- b
where both
master
,origin/master
point @b
.after that, fetch origin, , repo looks this:
initial -- -- b -- c -- d
where
master
points @b
,origin/master
point @d
.after that, merge ,
master
points @d
.
i can reset master
branch doing git reset --hard b
.
what reset origin/master
ref commit b
. and, not mean want reset remote repository state - want locally only. no pushing. want remote remain unchanged. want change knowledge of local repo regard state of remote repo.
how can that?
i can change files in .git directory, files? or there maybe git command it?
why need that? because want able replay scenario, test git-based project management i'm working on. replay same situation, in order see how behaves if change conditions slightly.
the safest way git update-ref refs/remotes/origin/master <sha>
. cause change recorded in reflog, should ever need refer it. though codewizard said, next fetch update ref anyway, there not risk in changing directly either.
Comments
Post a Comment