Multiple commit in single pull request

I am working on a project in Github using fork repo. I am new to Github and I have to make a GitHub action YAML file so for debug I simply do commit on the GitHub and now when everything is working fine, I have to make a pull request to the main repo but now I have 130 commits in a single pull request. My question is how to make it one or some better way to do so? WHat I have tried is to cherry-pick the last commit make a new branch and push it to first my remote repo, but it also contains 130 commits. enter image description here


Solution 1:

git rebase is showing noop since you're not specifying the starting commit of where you want to rebase from. You can do the following from command line.

Checkout to your noetic branch. Run the following command.

git rebase -i HEAD~130

In the interactive window, leave the first commit as pick and change the next 129 commits to squash. I have Vim as my default editor so I can run the following to easily squash the 129 unneeded commits:

:s/pick/squash/ 129

Once you're done, save & exit with: :wq

Do :wq again when the editor asks you to write your commit message (or edit the commit message as you like)

After this your rebase should be complete and you should have only one commit with all your changes.