Giter Site home page Giter Site logo

lfs-tracking-hook's Introduction

LFS Tracking Hook

Motivation

To register a concrete file to be tracked by the LFS, the right commands have to be executed in the right order.

The following example is taken from https://git-lfs.github.com/:

git lfs track "*.psd"

git add file.psd

git commit -m "Add design file"

git push origin master

These four commands have to be executed every time a new file is added to the LFS repository. If forgotten or executed in a different order, the files will not be tracked by the LFS and will be part of the standard git repository.

Additionally, git add and git lfs track behave differently in case of adding/tracking a content of subdirectories. git lfs track command does not recursively search in subdirectories unless an explicit glob expression is used.

Example:

git lfs track "*.psd" will add all "*.psd" in the current directory.

git add "*.psd" will add all "*.psd" in the current directory and its subdirectories.

Purpose

This git hook matches filenames of newly committed files against given RegExp definition. If a filename is matched, the git hook ensures the file is tracked by the LFS. Files already indexed by git repository are not considered.

Using the example above, it is necessary just execute the standard git commands:

git add file.psd

git commit -m "Add design file"

git push origin master

Installation

  1. Install LFS and initialize the LFS by ccommand git lfs install (once per machine)

  2. Create a file .gitlftracking in the root directory of the git repository.

  3. Add regular expressions matching filenames of files to be tracked, e.g.:

    JArchitectOut.*\.jdar

    *\.jpeg

    database.*\.mdb

  4. Commit the file .gitlftracking to the git repository.

  5. Copy the file https://github.com/dkoudela/lfs-tracking-hook/blob/master/pre-commit to the directory .git/hooks/ in the git repository.


Note 1.: If you already have a pre-commit hook in your git repository, you have to merge the scripts together.


Note 2.: As a pre-commit hook cannot be submitted to the git repository, the installation procedure has to be executed in every cloned git repository.


lfs-tracking-hook's People

Contributors

dkoudela avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.