LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

git-lock

Exclude a tracked file from further local changes

TLDR

Lock a file so Git ignores local edits to it
$ git lock [config/database.yml]
copy

SYNOPSIS

git lock filename

DESCRIPTION

git lock, a git-extras command, marks a single tracked file with Git's skip-worktree bit via `git update-index --skip-worktree`. Once locked, Git stops reporting local modifications to that file in `git status`/`git diff`, so edits you make won't accidentally get staged or committed.This is meant for files that need machine-specific local changes, such as `config/database.yml`, not for coordinating edits between teammates: it has no effect on the remote or on other clones, and it does not stop anyone else from committing changes to the same file. Use `git locked` to list currently locked files and `git unlock` to restore normal tracking.

PARAMETERS

FILENAME

Tracked file to lock.

INSTALL

sudo apt install git
copy
sudo dnf install git
copy
sudo pacman -S git
copy
sudo apk add git
copy
sudo zypper install git
copy
brew install git
copy
nix profile install nixpkgs#git
copy

CAVEATS

Part of git-extras (a thin wrapper around `git update-index --skip-worktree`), not core Git. This is a local, per-clone setting, not a shared or enforced lock. For real cross-team file locking, see `git lfs lock`.

HISTORY

git lock is part of git-extras, a community collection of Git utility scripts. It predates and is unrelated to Git LFS's server-enforced file locking.

SEE ALSO

RESOURCES

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid