0

I am new with Git, but I would need some help. How to get rid of those X commits? I don't want to push those local commits, since I don't have the rights to push into that specific branch (it's protected) and I realized that after I commited those changes.

I had some local commits, but I want somehow to discard them (they were not pushed to the origin/<branch_name>) and get rid of this error somehow.

In my IDE, it is showing me the 2 commits that exist in the <branch_name>, but don't exist in origin/<branch_name>.

stephsmith
  • 171
  • 5
  • `git reset --hard HEAD@{upstream}` or shorter version: `git reset --hard HEAD@{u}` or shortest version: `git reset --hard @@{u}` Note: local changes will be **LOST** – Jay Aug 04 '23 at 13:31

0 Answers0