Giter Site home page Giter Site logo

git_smudge_clean_example's Introduction

git smudge and clean example

Help you avoid to commit your sensitive keywords

git filter details, see https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes git filter smudge git filte clean

Setup Steps:

Add keyfilter.py

  1. copy keyfilter.py into your project
  2. to avoid committed keyfilter.py, add it into .gitignore

Add Git Attributes

  1. Add .gitattributes in your workspace, and add content as below
configData.json    filter=keyfilter
  1. Or edit .git/info/attributes if you don’t want the attributes file committed with your project
echo 'configData.json    filter=keyfilter' >> .git/info/attributes

Add Git Config Filter

  1. Add by command and it will add in .git/config, which will not be committed with your project
git config filter.keyfilter.smudge "python keyfilter.py --smudge"
git config filter.keyfilter.clean "python keyfilter.py --clean"
  1. Or edit .git/config, which will not be committed with your project
[filter "keyfilter"]
        smudge = python keyfilter.py --smudge
        clean = python keyfilter.py --clean
  1. Or add .gitconfig as local, which will be committed with your project. and add content in last step
git config --local include.path ../.gitconfig

Note:

  1. Avoid to use simple keywords, which may conflict with replace content, for example:
{
    "username": "user"
    "password": "pass"
}

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.