Home > Mobile >  Remove tracked file from Merge Request that was deleted using Gitlab Web Editor
Remove tracked file from Merge Request that was deleted using Gitlab Web Editor

Time:08-27

I accidentally committed a file that wasn't supposed to be in the MR. Then, using the web editor of Gitlab, I removed the file.

Now it shows up in the changes as 'file deleted' but I don't want the file change to be there at all. I currently have a lot more commits piled on top since the file removal.

How can I make sure that I can remove the deleted file from appearing in the MR changes at all?

CodePudding user response:

The easiest approach would be to make a new commit that restores the file to what it was before your changes. Let's say the file is myFile.txt, and the commit where you made your first change to it is 123abc. Do the following:

git checkout 123abc~ myFile.txt
git commit -am "Restoring myFile.txt"
  • Related