Delete changes on Github
I try to remove 3 brenches and keep the "master" brench. But i dont know how to do that.
24 Replies
failed to delete the branch from the remote repository, see the output window for more detailswhat does the output window say? do you only wanna remove branches or merge them into master / main?
remove the 3 incoming ones
i dont want to merge them i want to delete them if possible
they where mistakes
is the repo public? if yes please link
GitHub
GitHub - TheBaldCoder/TheBaldCoderBlog: My own blog website.
My own blog website. Contribute to TheBaldCoder/TheBaldCoderBlog development by creating an account on GitHub.
there are multiple ways to do what you want though.
one of the easier options in my opinion is to make a branch off of the commit you want to revert to
there is only a
master
branch in this repo 🤔and then force push that to your main branch
ohhhh he wants to revert commits
I'm so sorry its commits
i'm so dumb
nah all good
it was just a little missleading for me
you can use "git reset"
or you can make a branch off on the commit you want
and then force push the branch to the
master
branch
either of those options will work for you
just be careful doing what you are doing
in general you don't want to delete commits
you just push a new commit to fix itif you want to try the branch approach I mentioned:
but if i push a new one the changes "3 incoming" will be merged with it
yes
what is your issue with that?
sorry i mean if i make a new commit. The other 3 incoming changes will merge with the changes i made. But i want to delete those 3 commits
yes I understand, and I gave you two options to remove the commits if you want to do that
I'm just saying that in general you want to avoid deleting commits. it is generally better just to fix whatever the issue is with new commits
commits are historical
they help you find who changed what
at a given point in time
Oh i thought it was for project control. If your project gets corrupted or something then you could go back to the previous version
like a unity game that keeps crashing and you want to restore the changes you made
well returning to a previous version is definitely a use case for commits
but also for history
and finding out who made a change
but what is the proper way to do this? The 2 options you gave me?
I can't really answer that because "proper" is subjective
are you still wanting to remove the comits? if yes, then either option I mentioend with give you the exact same outcome
so either is fine
Thanks for the help. I'm making a different brench
yep, just make the branch on the commit you want to roll back to and then force push that branch into your master branch
then you can delete the extra branch you made when you are done
i will thanks