0
You can delete commits from gitlab using git commands?
I have tried through the visual studio of option > Team Explorer but without success
0
You can delete commits from gitlab using git commands?
I have tried through the visual studio of option > Team Explorer but without success
5
Try to reverse your commit in gitlab:
References:
If that’s not what you’re looking for, you can take a look at this documentation on Gitlab - Rollback Commits
Reverting is not deleting =/
3
You can try rewriting your history with git reset
and then give a git push --force
.
I’d rather do the reset
from the gitk
:
So you can do the reset
to any point in your history. To propagate this, you must make the call force push, where you force an update from branch remote. Occasionally, when the garbage collector fo Gitlab comes, its commits ancient really must be erased.
NOTE: if someone did the Fork of your project before you reset these values, then it is quite capable that these commits last. So, if you have classified information, act as soon as possible.
If you only want to eliminate a single commit from the list, it is possible to pick up the other commits after the git reset
doing the git cherry-pick
.
In my case, if I wished to remove the commit message "Tabulation where it is due", should still make 4 Cherry-Picks:
git cherry-pick 11de53691964
git cherry-pick f119d69fe118
git cherry-pick f119d69fe118
git cherry-pick 9065a4213bd5
I already needed to use this strategy to erase data that I went up erroneously to Github, fortunately I didn’t notice any reading in the project before adjustment. In other circumstances, I’ve had to undo merge requests on Gitlab. Several times.
Do the revert
did not suit me most of the time, because then causes confusion in the history with the old code (if it should really enter). The revert
, for me, it fit when the old code needs to be fully undone without further damage and it was already propagated too much to simply be erased via git reset
+ force push.
A situation o'concur where I used the revert
successfully was in the commit of merge, to create a new merge request with the revert
of revert
. This served to remove a slightly defective code that entered and also served as the basis for writing revision comments on the code.
If you don’t have access to the command line or simply delete it, you have the option via Web-GUI.
I’ll take the following example: I have a branch master
with the following commits (history order):
I want to rewrite it this way:
Removing the B from the history.
In my repository, I’ve already created a branch called fail-safe
for possible disasters.
First, we should create a new branch at commit A:
So we pulled the desired commit from the old branch (master
in the case):
After that, we selected the commits desired for Cherry-pick 75092a6b
. I opened in another tab, I recommend opening all the desired commits of Cherry-pick in other tabs (chronological order) and we selected the option cherry-pick
and target them as targets salvador-patria
:
Well, now we have a branch with the correct history: salvador-patria
. We just need to delete the master
and replace it with the history of salvador-patria
.
To do this, we need to remove the default from master
first (I did this by assigning to any other branch):
So now just create a new branch from salvador-patria
called master
and set it as default again. These two processes have already been shown earlier, so there’s no reason to make new gifs.
Browser other questions tagged git gitlab
You are not signed in. Login or sign up in order to post.
Related: https://answall.com/q/170531/64969
– Jefferson Quesado
Related, maybe even duplicate: https://answall.com/q/128578/64969
– Jefferson Quesado