How can I delete a commit that I made on GitLab
? This commit that I made is not the HEAD now.
If I can't delete it, can I edit?
When it was the HEAD, I tried:
git reset --soft HEAD git reset --soft HEAD^1 git revert HEAD git rebase -i HEAD git rebase -i HEAD~1 git reset --hard HEAD git reset --hard Id-Code
I already tried to rebase it, but it still stays on the branch. Now I just removed it from the HEAD, but it is still there.
There is another command?
then loop these steps : update the repository contents with git filter-repo. upload the modified contents. cleanup dangling references When this is done, the Gitlab project will be purged of all references to those old commits.
do the revert (or use git rebase -i <something before the bad commit> <temporary branch> to remove the bad commit) redo the merge. rebase your subsequent work back on: git rebase --onto <temporary branch> <old merge commit> <real branch> remove the temporary branch.
You can simply remove that commit using option "d" or Removing a line that has your commit. In the latest git version there is no more option d.
git reset --hard CommitId
git push -f origin master
1st command will rest your head to commitid and 2nd command will delete all commit after that commit id on master branch.
Note: Don't forget to add -f in push otherwise it will be rejected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With