Remove commits from a repository

Asked

Viewed 43 times

1

I needed some way to remove commits from a Fork mine from a repository and leave only the selected ones. I’ve tried to use git rebase, as suggested on several topics, but unsuccessfully, the changes didn’t apply to the repository, in addition to several conflicts, for example:

CONFLICT (add/add): Merge conflict in docs/translations/pt/scripting/functions/SetPlayerFacingAngle.md

The arguments I used in git rebase were: git rebase -i HEAD~5.

inserir a descrição da imagem aqui

1 answer

0


As far as I know, Jhon, git doesn’t allow removing commits from your history. The most you can do is a squash, as described in this tutorial.

If you have entered an unwanted change, it is a git reset (probably something like git reset --hard HEAD~1 to vote 1 commit, or git reset --hard <commit_id> to go back to a specific commit). But that doesn’t take the commit out of the history.

Another thing is in the settings in your pull requests - instead of just merging, you can do one squash merge, to group commits, turning PR commits into just 1.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.