Skip to content

Latest commit

 

History

History
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
    <title>Gitone: Combine multiple git version controls steps into one &#8212; Gitone 0.0.1 documentation</title>
    <link rel="stylesheet" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F_static%2Falabaster.css" type="text/css" />
    <link rel="stylesheet" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F_static%2Fpygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="./" src="proxy.php?url=https%3A%2F%2Fgithub.com.%2F_static%2Fdocumentation_options.js"></script>
    <script type="text/javascript" src="proxy.php?url=https%3A%2F%2Fgithub.com.%2F_static%2Fjquery.js"></script>
    <script type="text/javascript" src="proxy.php?url=https%3A%2F%2Fgithub.com.%2F_static%2Funderscore.js"></script>
    <script type="text/javascript" src="proxy.php?url=https%3A%2F%2Fgithub.com.%2F_static%2Fdoctools.js"></script>
    <script type="text/javascript" src="proxy.php?url=https%3A%2F%2Fgithub.com.%2F_static%2Flanguage_data.js"></script>
    <link rel="index" title="Index" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2Fgenindex.html" />
    <link rel="search" title="Search" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2Fsearch.html" />
    <link rel="next" title="Gitone command-line interface (CLI)" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2Fcli.html" />
    <link rel="prev" title="Welcome to Gitone’s documentation!" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2Findex.html" />
   
  <link rel="stylesheet" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F_static%2Fcustom.css" type="text/css" />
  
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

  </head><body>
  <div class="document">
    
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="proxy.php?url=https%3A%2F%2Fgithub.com.%2Findex.html">Gitone</a></h1>



<p class="blurb">A Python package for programmatic R markdown workflows</p>




<p>
<iframe src="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://ghbtns.com/github-btn.html?user=marskar&repo=gitone&type=star&count=true&size=large&v=2" rel="nofollow">https://ghbtns.com/github-btn.html?user=marskar&repo=gitone&type=star&count=true&size=large&v=2"
  allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe>
</p>





<h3>Navigation</h3>
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Project overview</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#introduction">Introduction</a></li>
<li class="toctree-l2"><a class="reference internal" href="#documentation-and-code">Documentation and Code</a></li>
<li class="toctree-l2"><a class="reference internal" href="#installation">Installation</a></li>
<li class="toctree-l2"><a class="reference internal" href="#usage">Usage</a></li>
<li class="toctree-l2"><a class="reference internal" href="#next-steps">Next Steps</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2Fcli.html">Command-line interface</a></li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2Fmodules.html">Module reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2Ftests.html">Test reference</a></li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="proxy.php?url=https%3A%2F%2Fgithub.com.%2Findex.html">Documentation overview</a><ul>
      <li>Previous: <a href="proxy.php?url=https%3A%2F%2Fgithub.com.%2Findex.html" title="previous chapter">Welcome to Gitone’s documentation!</a></li>
      <li>Next: <a href="proxy.php?url=https%3A%2F%2Fgithub.com.%2Fcli.html" title="next chapter">Gitone command-line interface (CLI)</a></li>
  </ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="proxy.php?url=https%3A%2F%2Fgithub.com.%2Fsearch.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>








        </div>
      </div>
      <div class="documentwrapper">
        <div class="bodywrapper">
          

          <div class="body" role="main">
            
  <div class="section" id="gitone-combine-multiple-git-version-controls-steps-into-one">
<h1>Gitone: Combine multiple <strong>git</strong> version controls steps into <strong>one</strong><a class="headerlink" href="#gitone-combine-multiple-git-version-controls-steps-into-one" title="Permalink to this headline">¶</a></h1>
<p><a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://travis-ci.org/py4ds/gitone"><img" rel="nofollow">https://travis-ci.org/py4ds/gitone"><img alt="Build" src="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://travis-ci.org/py4ds/gitone.svg?branch=master" rel="nofollow">https://travis-ci.org/py4ds/gitone.svg?branch=master" /></a> <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://gitter.im/py4ds/gitone?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge&amp;utm_content=badge"><img" rel="nofollow">https://gitter.im/py4ds/gitone?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge&amp;utm_content=badge"><img alt="Join the chat at https://gitter.im/py4ds/gitone" src="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://badges.gitter.im/py4ds/gitone.svg" rel="nofollow">https://badges.gitter.im/py4ds/gitone.svg" /></a> <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://opensource.org/licenses/MIT"><img" rel="nofollow">https://opensource.org/licenses/MIT"><img alt="License" src="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://img.shields.io/badge/License-MIT-brightgreen.svg" rel="nofollow">https://img.shields.io/badge/License-MIT-brightgreen.svg" /></a> <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://pypi.python.org/pypi/gitone"><img" rel="nofollow">https://pypi.python.org/pypi/gitone"><img alt="PyPI" src="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://img.shields.io/pypi/v/gitone.svg" rel="nofollow">https://img.shields.io/pypi/v/gitone.svg" /></a> <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://www.repostatus.org/#active"><img" rel="nofollow">https://www.repostatus.org/#active"><img alt="Project Status: Active – The project has reached a stable, usable state and is being actively developed." src="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://www.repostatus.org/badges/latest/active.svg" rel="nofollow">https://www.repostatus.org/badges/latest/active.svg" /></a> <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://pyup.io/repos/github/py4ds/gitone/"><img" rel="nofollow">https://pyup.io/repos/github/py4ds/gitone/"><img alt="Updates" src="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://pyup.io/repos/github/py4ds/gitone/shield.svg" rel="nofollow">https://pyup.io/repos/github/py4ds/gitone/shield.svg" /></a> <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://www.python.org/downloads/"><img" rel="nofollow">https://www.python.org/downloads/"><img alt="PyPI - Python Version" src="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://img.shields.io/pypi/pyversions/gitone.svg" rel="nofollow">https://img.shields.io/pypi/pyversions/gitone.svg" /></a></p>
<div class="section" id="introduction">
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<p>The <code class="docutils literal notranslate"><span class="pre">gitone</span></code> Python package takes some of the tedium out of <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://git-scm.com/">git</a" rel="nofollow">https://git-scm.com/">git</a> version control by rolling multiple git shell commands into one shell command or Python function.</p>
<p>Unlike git shell commands, <code class="docutils literal notranslate"><span class="pre">gitone</span></code> shell commands and Python functions can automatically generate commit messages if a commit message is not provided!</p>
<p>You can use <code class="docutils literal notranslate"><span class="pre">gitone</span></code> in</p>
<ul class="simple">
<li><p>your terminal (e.g. <code class="docutils literal notranslate"><span class="pre">bash</span></code>, <code class="docutils literal notranslate"><span class="pre">zsh</span></code>, <code class="docutils literal notranslate"><span class="pre">fish</span></code>, etc.) or</p></li>
<li><p>your favorite Python environment (e.g. <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://www.jetbrains.com/pycharm/">PyCharm</a" rel="nofollow">https://www.jetbrains.com/pycharm/">PyCharm</a> or <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://code.visualstudio.com/docs/python/python-tutorial">Visual" rel="nofollow">https://code.visualstudio.com/docs/python/python-tutorial">Visual Studio Code</a>).</p></li>
</ul>
<p>The <code class="docutils literal notranslate"><span class="pre">gitone</span></code> Python package consists of 8 shell commands and Python functions:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">cam</span></code>, which stands for <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">commit</span> <span class="pre">-am</span></code>, will add and commit all changes made to tracked files.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">camp</span></code>, which stands for <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">commit</span> <span class="pre">-am</span> <span class="pre">&amp;&amp;</span> <span class="pre">git</span> <span class="pre">push</span></code>, will add and commit all changes made to tracked files and push the commit to the remote repository.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">acm</span></code>, which stands for <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">add</span> <span class="pre">--all</span> <span class="pre">&amp;&amp;</span> <span class="pre">git</span> <span class="pre">commit</span> <span class="pre">-m</span></code>, will add and commit all changes made to all files and push the changes to the remote repository.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">acmp</span></code>, which stands for <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">add</span> <span class="pre">--all</span> <span class="pre">&amp;&amp;</span> <span class="pre">git</span> <span class="pre">commit</span> <span class="pre">-m</span> <span class="pre">&amp;&amp;</span> <span class="pre">git</span> <span class="pre">push</span></code>, will add and commit all changes made to all files and push the changes to the remote repository.</p></li>
</ul>
<p>In summary, <code class="docutils literal notranslate"><span class="pre">cam</span></code> and <code class="docutils literal notranslate"><span class="pre">camp</span></code> work on only tracked files (those that have previously been added to git’s index),
while <code class="docutils literal notranslate"><span class="pre">acm</span></code> and <code class="docutils literal notranslate"><span class="pre">acmp</span></code> work on all files by adding untracked files to git’s index.</p>
<p>There are also the <code class="docutils literal notranslate"><span class="pre">--amend</span></code> versions of the above:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">amend</span></code>, which is short for <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">commit</span> <span class="pre">--amend</span> <span class="pre">-am</span></code>, will overwrite the previous commit by adding and committing all changes made to tracked files.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">amendp</span></code>, which is short for <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">commit</span> <span class="pre">--amend</span> <span class="pre">-am</span> <span class="pre">&amp;&amp;</span> <span class="pre">git</span> <span class="pre">push</span> <span class="pre">--force</span></code>, will overwrite the previous commit by adding and committing all changes made to tracked files and then force push the overwritten commit to the remote repository.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">aamend</span></code>, which is short for <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">add</span> <span class="pre">--all</span> <span class="pre">&amp;&amp;</span> <span class="pre">git</span> <span class="pre">commit</span> <span class="pre">--amend</span> <span class="pre">-m</span></code>, will overwrite the previous commit by adding and committing all changes made to all files.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">aamendp</span></code>, which is short for <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">add</span> <span class="pre">--all</span> <span class="pre">&amp;&amp;</span> <span class="pre">git</span> <span class="pre">commit</span> <span class="pre">--amend</span> <span class="pre">-m</span> <span class="pre">&amp;&amp;</span> <span class="pre">git</span> <span class="pre">push</span> <span class="pre">--force</span></code>, will overwrite the previous commit by adding and committing all changes made to all files and then force push the overwritten commit to the remote repository.</p></li>
</ul>
<p>Similarly to the first four, <code class="docutils literal notranslate"><span class="pre">amend</span></code> and <code class="docutils literal notranslate"><span class="pre">amendp</span></code> work on only tracked files (those that have previously been added to git’s index),
while <code class="docutils literal notranslate"><span class="pre">aamend</span></code> and <code class="docutils literal notranslate"><span class="pre">aamendp</span></code> work on all files by adding untracked files to git’s index.</p>
<p>All <code class="docutils literal notranslate"><span class="pre">gitone</span></code> functions and commands rely on the <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://gitpython.readthedocs.io/">GitPython</a" rel="nofollow">https://gitpython.readthedocs.io/">GitPython</a> Python library.
The command line interface relies on the <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://click.palletsprojects.com/">click</a" rel="nofollow">https://click.palletsprojects.com/">click</a> Python library.</p>
</div>
<div class="section" id="documentation-and-code">
<h2>Documentation and Code<a class="headerlink" href="#documentation-and-code" title="Permalink to this headline">¶</a></h2>
<p>The documentation is hosted at <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://py4ds.github.io/gitone/">https://py4ds.github.io/gitone/</a>.</p" rel="nofollow">https://py4ds.github.io/gitone/">https://py4ds.github.io/gitone/</a>.</p>
<p>The code is hosted at <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://github.com/py4ds/gitone">https://github.com/py4ds/gitone</a>.</p">https://github.com/py4ds/gitone">https://github.com/py4ds/gitone</a>.</p>
</div>
<div class="section" id="installation">
<h2>Installation<a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h2>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ pip install gitone
</pre></div>
</div>
</div>
<div class="section" id="usage">
<h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2>
<p>Run any of the available shell commands or Python functions without arguments and a commit message will be automatically generated.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">camp</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">acmp</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cam</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">acm</span><span class="p">()</span>
</pre></div>
</div>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ camp
$ acmp
$ cam
$ acm
</pre></div>
</div>
<p>You can also pass a commit message to any of the functions or shell commands.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">camp</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="s2">&quot;Made some changes.&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">acmp</span><span class="p">(</span><span class="s2">&quot;Lemme try something.&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cam</span><span class="p">(</span><span class="s2">&quot;Not sure what changed.&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">acm</span><span class="p">(</span><span class="s2">&quot;Should be OK now.&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>When using the shell commands. Do not wrap the commit message in quotes (<code class="docutils literal notranslate"><span class="pre">&quot;&quot;</span></code>) or they will be included in the commit message.</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ camp Made some changes.
$ acmp Lemme try something.
$ cam Not sure what changed.
$ acm Should be OK now.
</pre></div>
</div>
<p>To overwrite the previous commit, you can use the amend functions.</p>
<p>If you do not provide a commit message, the previous commit message will be reused.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">amend</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">amendp</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">aamend</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">aamendp</span><span class="p">()</span>
</pre></div>
</div>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ amend
$ amendp
$ aamend
$ aamendp
</pre></div>
</div>
</div>
<div class="section" id="next-steps">
<h2>Next Steps<a class="headerlink" href="#next-steps" title="Permalink to this headline">¶</a></h2>
<p>Setting up a repo can be a pain.</p>
<ul class="simple">
<li><p>Write an <code class="docutils literal notranslate"><span class="pre">init</span></code> function and command to handle all of the repo setup steps like in <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://github.com/py4ds/cookiecutter/blob/master/%7B%7Bcookiecutter.repo%7D%7D/Makefile#L21">this">https://github.com/py4ds/cookiecutter/blob/master/%7B%7Bcookiecutter.repo%7D%7D/Makefile#L21">this Makefile</a>. Inspired by the <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://usethis.r-lib.org/reference/use_github.html">usethis</a" rel="nofollow">https://usethis.r-lib.org/reference/use_github.html">usethis</a> R package.</p></li>
</ul>
</div>
</div>


          </div>
          
        </div>
      </div>
    <div class="clearer"></div>
  </div>
    <div class="footer">
      &copy;2019, Martin Skarzynski.
      
      |
      Powered by <a href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"http://sphinx-doc.org/">Sphinx" rel="nofollow">http://sphinx-doc.org/">Sphinx 2.0.1</a>
      &amp; <a href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://github.com/bitprophet/alabaster">Alabaster">https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
      
      |
      <a href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F_sources%2Freadme.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    
    <a href="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://github.com/marskar/gitone">https://github.com/marskar/gitone" class="github">
        <img style="position: absolute; top: 0; right: 0; border: 0;" src="proxy.php?url=https%3A%2F%2Fgithub.com.%2F%3Ca+href%3D"https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" rel="nofollow">https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"  class="github"/>
    </a>
    

    
  </body>
</html>