Git Remove Unnecessary Commits from a Pull Request

I started working on the project and I made some unwanted commits that I clicked on the original. Now, when I try to execute the transfer request, Github wants to fulfill all the previous commits.

My question is: how to remove unnecessary commits and commit the changes that I want to make so that I am in the know of the wizard?

+52
git github pull-request
Jan 20 2018-12-12T00:
source share
2 answers

I assume that your origin is your own fork of any project that you want to do also for a tensile request?

Since you will change the story (by resetting the head), you need to click with the -force flag. Find the hash of your last good commit with git log .

Now run

 git reset SHA 

This will change your head to this step and save the changes to the files since the last good commit, your index will also be reset.

Now you can change your code and execute the commits you made. But you have to do git push --force since you changed the repository history. This means that anyone who forks your repository will no longer be able to distract you from the changes. But you can make a pull request upstream.

+34
Jan 24 2018-12-12T00:
source share

If you are using git gui, Goto git gui and visualize your branch history. (before taking the next step, make a backup of the local changes that you want to click) Right-click to the point where the branch wants to reset execute the wizard and click reset. After resetting, type git push -f at the command prompt. Now make the necessary changes to the branch, complete n push again. If you now create a transfer request, it will only have a new commit after the reset branch.

0
Jan 24 '13 at 4:32
source share



All Articles