Return pressed branch to specific commit

I merged the dev branch (with constant, sometimes erratic changes) to our main branch (where we keep the released, stable code). I want to restore the main branch to a state that was earlier, as never before merging with the dev branch (and that when in the future we merge the dev branch, all changes that we discard will now be merged "again").

This is the current status of the lead branch, and I want to commit "commit-1.1.2" commit / tag in HEAD.

status of the master branch

I tried:

$ git revert -n professional-1.1.2..HEAD
fatal: Commit 9167e846a387c793edbc089c7ab6bd9eb8260456 is a merge but no -m option was given.
$ git revert -n -m 1 professional-1.1.2..HEAD
fatal: Mainline was specified but commit 380169097f35d07466640bc0db1b639278cd25fa is not a merge.
$ git revert -n -m 2 professional-1.1.2..HEAD
fatal: Mainline was specified but commit 380169097f35d07466640bc0db1b639278cd25fa is not a merge.

, git reset --hard professional-1.1.2 git push --force Git: [branch] to commit? push'd git commit. , -, ( , ... , ), , .

, : git revert something git reset --hard <TAG> && & git push --force? git revert, ?

+3
3

-m number , ( ).

, git revert -m 1 HEAD git revert -m 1 SHA_OF_MERGE_COMMIT ( git checkout master; git merge devel;)

+6

master , professional-1.1.2, , , professional-1.1.2. :

# Check that "git status" is clean, since the steps that follow will throw
# way uncommitted changes:
git status

# Set the index (staging area) to be as it was at professional-1.1.2:
git read-tree professional-1.1.2

# Create a commit based on that index:
git commit -m "Reverting to the state at professional-1.1.2"

# Your working tree will still be as it was when you started, so
# you'll want to reset that to the new commit:
git reset --hard

, , , , ( , , "" git read-tree).

+6

If you are a daredevil (recovery from the upstream may be required for all other committers)

git checkout yourbranch
git reset HEAD <commit-hash>
git push origin yourbranch -f
+2
source

All Articles