I want to reset the changes on the gray path, (origin/master) and keep what I have in the blue line (master). How do I do this?
Asked
Active
Viewed 72 times
1
-
1Do you really want to erase all changes on origin/naster and only keep your local `master`? – dan1st Sep 12 '21 at 05:50
-
2Does this answer your question? [Resetting remote to a certain commit](https://stackoverflow.com/questions/5816688/resetting-remote-to-a-certain-commit) – SwissCodeMen Sep 12 '21 at 07:00
-
`git push -f origin master` – phd Sep 12 '21 at 09:35
1 Answers
2
Your blue line is "master" branch, which local. The grey line is pushed to the remote, hence the top commit is "remote/master". To sync them up do a "force push" your local to the remote. This will rewrite the remote history.
If both lines were local branches, e.g. the grey line was "branch1", then you could have just do a "hard reset" from one to another.
And lastly, if you can always turn on "reflogs" (under View menu) to see all commits that are no longer referenced by any other 'ref' such as branch or tag.

RussKie
- 1,630
- 11
- 20