title: git: keep depth=1 on pulls to reduce repo size
body: <p>Is there a way to make <code>git pull</code> keep <code>depth=1</code>, just use the latest commit, instead of the one that git clone was made (if there is newer one)?</p>
  
  <p>I I do <code>git clone -b some_branch --depth=1 git_repo.git</code></p>
  
  <p>It clones the repository with minimum space usage because it removes all the history.
  Now if I need to update that repository again and use <code>git pull</code>, it pulls the whole history.</p>
  
  <p><strong>There is a similar question here:</strong> </p>
  
  <blockquote>
    <p><a href="https://stackoverflow.com/questions/23986685/pull-updates-with-git-after-cloned-with-depth-1">Pull updates with git after cloned with --depth 1</a></p>
  </blockquote>
  
  <p>If try accepted answer advice and use <code>git pull --unshallow</code> and then <code>git pull --depth=1</code>, it looks like it does not reduce space as <code>git clone --depth=1</code> does.</p>
  
  <p>So the only way to really reduce repository size is to just remove repository and clone with <code>depth=1</code> again?. Looks kind of clunky way to do it.</p>
  
  <p>And the reason I need this is that there are repositories used when fully cloned, currently take about <code>~3 GB</code> in size. And there are like 40 environments where it is used. So in total, it uses a lot of space. With a shallow clone, it can be reduced about 5 times.</p>
  
  <p><strong>Sample:</strong></p>
  
  <p>Cloning this repository branch 12.0 <code>git@github.com:odoo/odoo.git</code>, shows its size to be around 3 GB.</p>
  
  <p>Cloning this repository branch 12.0 with <code>depth=1</code>, shows size to be 643 MB.</p>
  
  <p>Using <code>--unshallow</code> on pull and then (as suggested here <a href="https://stackoverflow.com/questions/4698759/converting-git-repository-to-shallow">Converting git repository to shallow?</a>):</p>
  
  <pre><code>git pull --depth 1
  git gc --prune=all
  </code></pre>
  
  <p>Does not seem to shrink size as shallow clone does.</p>