Home

Awesome

Unity Git Locks

Provides an extensive Unity integration for Git LFS locks, which are are essentials when working in teams to prevent conflicts, especially on binary files.

<img src=".docs\img\lockswindow.PNG" alt="Locks window" width="50%"/>

Philosophy

The plugin uses simple calls to the Git LFS locks commands, which means you have to make sure that your setup is configured correctly to use LFS locks through the CLI. It also makes it independent from any authentication process: if you can use it through command line it will work in Unity!

This tool is intended to be used by developers, designers and artists alike, providing a flexible, easy and safe way of working as a team.

   

How to use

Installation

The easiest way is probably to add this repository as a package, either:

Automatically (with url https://github.com/TomDuchene/unity-git-locks.git)

• Manually, by cloning this repository in your repository's Packages folder

Repository configuration recommendations

We recommend that you setup your repository to not set as read-only the files that haven't been locked:

git config lfs.setlockablereadonly false

This allows users to modify any file and only prevents them from pushing changes to a locked file. The tool displays (opt-out) warnings when modifying a file that has been locked by someone else.

It also means you won't have to declare which file types are lockable.

You could in theory use the tool with the read-only mode enabled but it has not been tested.

Initial setup

The only thing you absolutely need to setup before use is your provider's (e.g. Github) username, so the tool knows that it's you. You have to input it in the Preferences window (Edit/Preferences/Git Locks/Git host username), which is also accessible through the "Git Locks" window.

<img src=".docs\img\username.PNG" alt="Set Username" width="50%" />

Troubleshooting

Every git setup is a little bit different, so here's a troubleshooting wiki page to help if you have errors.

   

Features

Main window

<img src=".docs\img\lockswindow.PNG" alt="Main locks window" width="50%" />

Accessible through Window/Git Locks, this window will show you :

Contextual menus

<img src=".docs\img\context_hierarchy.jpg" alt="Hierarchy" width="40%" /><img src=".docs\img\context_project.jpg" alt="Project" width="50%" />

On a right-click, you can lock/unlock any file in the project window, and lock/unlock prefabs in the hierarchy window.

Multi-selection and folder selection are supported, provided that the files in the selection are all lockable / all unlockable.

In the project window, you can also show the file's git history, in a terminal (default) or in a browser (configurable through the settings).

Lock icons

Lock icons are displayed on all locked files and folders in the Git locks, Project, and Hierarchy windows. They can be clicked to obtain information on their status and unlock them directly (if they are yours).

All locks are color-coded :

<img src="Editor\Textures\greenLock.png" alt="Lock" width="20"/>File locked by you

You’re safe working on it (don’t forget to unlock it when you’re done). Also displayed on a folder containing at least one of your locks.

<img src="Editor\Textures\orangeLock.png" alt="Lock" width="20"/>File locked by someone else

You shouldn’t modify it (if you need to you can ask the owner of the lock to release it, if he/she’s drinking coconut water in Miami for the next two months you could probably force the unlock in the Git Locks window). Also displayed on a folder containing at least one of someone else's locks.

<img src="Editor\Textures\redLock.png" alt="Lock" width="20"/>File locked by someone else conflicting with your changes

Someone has locked this file but you’ve made changes to it anyway which you will not be able to push (if you’re just testing things out it’s ok, but you’ll have to discard changes before you push)

<img src="Editor\Textures\mixedLock.png" alt="Lock" width="20"/>Folder containing locks by you and someone else

This folder contains both locks of yours and others.

Preferences

<img src=".docs\img\preferences.PNG" alt="Set Username" width="50%" />

Many options are available to customize your use of the tool:

Keyboard shortcuts

In the project window, you can use Ctrl + Maj + L or U to Lock/Unlock a file or selection of files.

If you prefer having shortcuts to lock/unlock prefabs in the hierarchy, you can add some in Edit / Shortcuts / “Main Menu/GameObject/Git LFS Lock” (or “Unlock”)

   

Misc

This tool has been created by Tom Duchêne at Tactical Adventures, and is under the M.I.T. license. We might examine bug reports and pull requests but we can't offer you any kind of warranty or active support. We hope this tool helps your team as much as it helped ours ♥