Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I agree with Sergiu Dumitriu in this not being a very good idea. But still git provides exactly what you are looking for. Even though this will only work if your central coding style is very well defined and strictly followed. Here’s how it works:</p> <p>Git provides <a href="http://git-scm.com/book/ch7-2.html#Keyword-Expansion" rel="nofollow noreferrer">smudge/clean filters</a>. They allow you to pass all code through a so-called “smudge” filter on checkout and reverse that with a “clean” filter when code is added to the staging area. These filters are set in <code>.gitattributes</code>, and there is a repository-local version of that file available in <code>.git/info/attributes</code>. So you set your smudge filter to a tool that will change the code to your personal coding style on checkout:</p> <p><img src="https://i.stack.imgur.com/Y8cfE.png" alt="smudge filter"></p> <p>And your clean filter will convert the code back to the central coding style on checkin (more precisely: when file are staged):</p> <p><img src="https://i.stack.imgur.com/aYERj.png" alt="clean filter"></p> <p>It is very important, that <code>smudge -&gt; clean</code> is a no-op / generates the original file again. Otherwise you will still check in format changes every time you change a file.</p> <p>Using smudge and clean filters will retain all the functionality of git (including <code>git diff</code> etc). You can find the full docu in <a href="https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html#_tt_filter_tt" rel="nofollow noreferrer"><code>git help attributes</code></a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload