I am bad at GIT CLI. I needed to remove a couple of commits from a branch. I did it using TortoiseGit. Here are the steps. First, right click Tortoisegit in the File Explorer and open the Rebase... window:
- In the Branch dropdown, select the branch.
 - In the Upstream dropdown, select the main branch.
 - Select Force Rebase.
 - In the main window, click on a commit that is to be removed. Inspect the files in the second window to make sure. Then, right click on the commit and select Skip.
 - Click on the button Start Rebase.
 
Posted by kiatng to Git (2023-07-22 03:56)