gitversioninggit-extensions

GIT-Extensions: how to set "origin" branch on a previous value?


I have a "dev" branch, local as well as remote (origin), and I would like to set the remote branch on a previous commit:

Current situation (GIT-extensions screenshot):

enter image description here

I would like the "origin/dev" remote branch to refer to the entry below, while keeping the local "dev" branch on the same spot.

How can I do this?

For your information: I already tried "reset current branch to here", but that keeps the "origin/dev" and moves the "dev" (the local one), but I want just the opposite.


Solution

  • origin/dev reflects state of dev branch in the remote origin repository.

    So you can only move origin/dev by updating the remote branch which is done by pushing.

    If your state has still not changed and the image still reflect your current branch state, you could update it by pushing either HEAD~ or equivalent in this case dev~ (i.e. the parent commit of HEAD or dev commit. You can also use the hash of the commit but it's less convenient).

    It will looks like that when pushing:

    enter image description here

    Note: "Force with lease" (or "Force push") are mandatory because you want to "remove" a commit from the existing remote branch.