Removing commits from a Pull Request

I have been on this issue for some time now. How can I remove commits from a PR? Another issue I am experiencing is that a new PR include older PRs. If I create a PR named X and then create another Y, Y will have two commits, X and Y instead of one.

the commits on a PR are those on a branch.
If you have extra commits on a branch it can mean:

  • you created the branch from a branch that is not main
  • your main is not clean

how to solve:
make sure your main branch is up to date and doesn’t have extra commits with the upstream main.
If your main has extra commits, while on main you should be able to reset it with git reset --hard upstream/main

After that, go to the branch for the PR and go git rebase -i main. This will allow you to do an interactive rebase, change the commits you need to remove to d or drop.
After that you will need to git push -f <branch-name> to do a force push

Hello.

Things have become tangled. It seems I am running into deeper problems with each command. The first command didn’t work, and after that, I was unable to switch between branches. The terminal is prompting that some of the filenames are too long. At this point, I am confused about what is what, I ran so many commands and think I might have conflicted myself.

Would it be a good idea to close the PR and open a new one?

As long as you are willing to tackle this, I’d keep trying to untangle this. Getting main branch in sync will be needed anyway to make further PRs without similar issues.

There are two parts of this, but focus on one task until that’s completed.

For getting main branch in sync, check out also the Steps #1 and #2 from Contribute to the Codebase | Contribute | freeCodeCamp.org. After that’s done correctly, on Github page of your fork’s main branch, should be information that branch is either in sync, or is behind of freeCodeCamp/freeCodeCamp:main.

If there are some errors while trying to do it, please share them.

I have divided the problem into chunks. The first chunk is to solve the "filename too long " problem which is preventing me from switching branches.
I have tried resolving it by enabling the Enable Long Path Support: on my computer but it did not work.

I decided to configure git to accept long names using this command git config --system core.longpaths true but permission was denied.

My main branch is ok, I did allow syncing so that I’m not behind by commits, and I’m confident I can now resolve the issue if I can switch between branches.

From what I’m finding git config --system core.longpaths true needs to be run as administrator. Otherwise removing the --system or replacing it with --global might work.

Are you running it in WSL? The native development on Windows is not supported by freeCodeCamp.

One more clarification regarding the main branch - if on Github it’s written that branch is ahead of freeCodeCamp/freeCodeCamp:main, then that’s not correct.

This is the source of my woes; I am running it on Windows :man_facepalming: That is why I have had dependencies compatibility problems with other codebases.

I need to fix this first. Thank you. The articles were useful.

Contribute page has another article regarding using WSL, see Set up freeCodeCamp on Windows Subsystem for Linux (WSL) | Contribute | freeCodeCamp.org

I had plans to migrate to Ubuntu, it will be a better idea. I have worked with Kali Linux before.