Git LFS and deleted assets reappearing

Happy new year!

I’ve been trying to get my head around this issue for a while, but can’t figure out a solution for it.
My project is set up using git with LFS configured.

Once I add an Actor to my Map and commit this change to git, I cannot permanently remove it afterwards. In Detail: When I close the editor and open it again later (not immediately after closing, seems this takes a certain amount of time) the deleted Actors reappear.

This is extremely annoying (e.g. in case of re-designing rooms and having nearly invisible - like glass- objects that act blockingly) and caused my quite some headache recently.

I know there’s been some people asking this before (see here and here. And here too), but never with a solution.

Does anyone have an idea how to get rid of this vexing behaviour?

Thanks in advance & cheers
Seb.

Hi!

Check LFS config or possibly turn it off. Had some problems too.
Asked my dear AI and came up with this tldr;

best

The issue you're describing, where deleted actors reappear after committing changes to **Git with LFS**, is likely caused by either **Git LFS misconfiguration** or **redirectors/auto-save behaviors** in Unreal Engine. Here's a detailed approach to troubleshoot and resolve this:

---

### **1. Identify the Problem Source**
1. **Actor Persistency Issue**:
   - Unreal Engine saves actors in the level `.umap` file. If Git LFS is improperly configured or overwrites files when pulling changes, these deletions may be reverted.

2. **Possible Causes**:
   - Unreal Engine auto-saving an older version of the level.
   - Redirectors or cached data pointing to outdated versions of the `.umap` file.
   - Git LFS not properly tracking the `.umap` file, leading to version mismatches.

---

### **2. Verify Git LFS Configuration**
Ensure `.umap` and other binary files are properly tracked by Git LFS:
1. **Check Git LFS Tracking**:
   Run the following command in your project directory:
   ```bash
   git lfs track

Ensure the output includes .umap:

*.umap filter=lfs diff=lfs merge=lfs -text
  1. Manually Track .umap Files:
    If .umap files are not tracked, add them to Git LFS:

    git lfs track "*.umap"
    

    Commit the .gitattributes file:

    git add .gitattributes
    git commit -m "Track .umap files with LFS"
    
  2. Verify LFS Objects Are Uploaded:
    Ensure the .umap file is stored on the LFS server by running:

    git lfs push --all
    
  3. Ensure Proper Pull Behavior:
    Check that your local repository correctly pulls LFS-tracked files:

    git lfs pull
    

3. Delete Actors and Save Changes

  1. Delete the Actors in Unreal:

    • Open the level in Unreal Editor.
    • Delete the unwanted actors.
    • Save the level (Ctrl+S or File > Save All).
  2. Commit the Changes:

    • Stage and commit the updated .umap file to Git:
      git add Content/Maps/<YourMap>.umap
      git commit -m "Removed unwanted actors from level"
      git push
      

4. Check for Unreal Auto-Saves and Backups

  1. Disable Auto-Save Temporarily:

    • Go to Edit > Editor Preferences > Loading & Saving > Auto-Save.
    • Disable auto-save or reduce its frequency to prevent overwriting.
  2. Clear Auto-Save and Backup Folders:

    • Navigate to the Saved/Autosaves folder in your project directory:
      <ProjectFolder>/Saved/Autosaves/
      
    • Delete any autosave versions of the level.
    • Also, check the Backup folder and remove outdated versions:
      <ProjectFolder>/Saved/Backup/
      

5. Fix Redirectors

Redirectors can cause Unreal Engine to reference deleted or moved actors:

  1. Open the Content Browser.
  2. Right-click the folder containing your .umap file.
  3. Select Fix Up Redirectors in Folder.

6. Validate Level Changes

After saving and committing the changes:

  1. Close Unreal Engine.
  2. Reopen the project and confirm the actors remain deleted.
  3. Test by pulling the project in a fresh clone:
    • Clone the repository into a new folder:
      git clone <repository-url>
      
    • Open the project and verify that the level reflects the changes.

7. Collaborator Sync Issues

If working with others, ensure all collaborators:

  1. Have Git LFS installed and configured properly.
  2. Pull the latest changes and do not overwrite .umap files with stale data.

8. Final Verification

  1. Check File Locks (Optional):
    • Use Git LFS’s locking feature to prevent simultaneous edits to the same .umap file:
      git lfs lock "Content/Maps/<YourMap>.umap"
      
  2. Monitor for Reappearance:
    • If the actors reappear, investigate Git history to identify if a collaborator or script caused the reversion:
      git log -p Content/Maps/<YourMap>.umap
      

Summary

To resolve the issue:

  1. Verify Git LFS properly tracks .umap files.
  2. Delete the actors, save the level, and commit changes.
  3. Clear auto-save and backup folders to remove conflicting versions.
  4. Fix redirectors in Unreal Editor.
  5. Test the changes in a clean clone.

If the issue persists, provide details about your Git configuration or Unreal logs, and I’ll help debug further! :blush:

Thank you so much for your extensive reply!

Going through this step by step, but first have to add a few pieces of information:

  • Revision Control was (up to now) disabled within Unreal, I’ve been using external tools (commandline and SourceTree)
  • Push/Pull, collaboration and concurrency is definitely not an issue, since I work alone & locally only (I do sync backups on a daily basis, but don’t push to a remote right now). That also makes it hard to test on a clean clone :frowning:
  • A very similar behaviour has occured in the Content Browser, where I moved stuff around and it reappeared the next day, causing ambiguity (same name, different Asset). These were caused by redirectors and could be solved by
    forcing an update of those redirectors.
  1. LFS Configuration
*.uasset filter=lfs diff=lfs merge=lfs -text
*.pdb filter=lfs diff=lfs merge=lfs -text
*.umap filter=lfs diff=lfs merge=lfs -text
  1. Delete Actors and Save changes

I did…

  • …Open Unreal Editor from a clean git state
  • …removed a Camera from the default level
  • …clicked Save All and the level’s Save button (just to make sure :wink: )

git status:

Refresh index: 100% (7107/7107), done.
On branch master
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   Content/StarterContent/Architecture/Floor_400x400.uasset
        deleted:    Content/__ExternalActors__/Maps/PyroneumTransporter/7/PZ/LM4A7Y28V7RIBUSX3WOKNZ.uasset

The deleted uasset is listed as change, but the .umap is not. The last changed timestamp on the .umap is from 5 days ago…while I work on this thing every day (What causes changes to the umap?).
This seems to be an issue. Also, the listed modification of the floor asset appears almost every time I commit changes.

Nevertheless, when I open my editor, the camera remains gone. It’ll probably reappear tomorrow. If so, I will get in touch.

What’s noticeable already is the fact that I enabled the UE internal revision control mechanism. It takes longer to start up and performs different operations, i.e. when fixing redirectors (actually performs delete operations on the filesystem when a redirector is no longer needed).
Maybe UE behaved differently when it was set to non-versioned and this caused the issues? This is gonna be interesting to watch!

  1. Other things
  • Backups are not present in <ProjectFolder>/Saved/Backups
  • Autosaves contained two earlier versions (both from 2 Months ago), which I deleted. I deactivated the feature for the time being.

So, I will update this thread soon to provide feedback! Thanks, mate!

Use Git with Unreal, as it allows you to track changes in blueprints. There’s an urban myth about issues, but it’s false, and use for submits.
Create a .bat file to handle Push operations.

The real issue lies with SourceTree, which regenerates files deleted/moved in Unreal. Use it only for reverting or advanced actions, but never open SourceTree if you’ve deleted/moved files in Unreal without submitting first.

If you’re working in a team, don’t fix redirectors on your own. Agree on a specific day to do it together, ensuring no one is working at the same time.