How to remove commits from a branch

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:

Image

  1. In the Branch dropdown, select the branch.
  2. In the Upstream dropdown, select the main branch.
  3. Select Force Rebase.
  4. 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.
  5. Click on the button Start Rebase.
kiatng