How to reset source / master ref locally

I have the following script:


  • I have 3 commits in my local repo, for example:

    initial -- a -- b

    where both masterand origin/masterindicate b.

  • After that, I take the origin, and the repo looks like this:

    initial -- a -- b -- c -- d

    where masterpoints to band origin/masterto a point d.

  • After that, I merge and now masteralso points to d.


I can split reset my masterby doing git reset --hard b.

What I would like to do is also reset origin/masterref to commit b. And I don’t want me to want the remote reset repository to be in any state - I want to do this only locally. Do not push. I want the remote control to remain unchanged. I want to change the knowledge of my local repo regarding the status of the remote repo.

How can i do this?

Maybe I can change some files in the .git directory, but which files? Or maybe some git command for this?

Why do I need it? Because I want to be able to reproduce the script to easily test the git-based project management I'm working on. I would like to reproduce the same situation in order to see how it behaves if I change the conditions a bit.

+4
source share
2

- git update-ref refs/remotes/origin/master <SHA>. , reflog, - . , codeWizard, ref , .

+3

git - "" -1 .
, .

.git/refs/heads/master 
.git/refs/remotes/origin/master

SHA-1, .
, , , .

.git/refs/remotes/origin/master SHA-1 , , , git fetch

+1

All Articles