<p>
Git is a distributed version control system (VCS).<br />
It is used for source control management (SCM).
</p>

<h3>Installation</h3>
<p>
Git is part of the official Debian repository:
</p>
<pre><code class="language-bash">apt install git
</code></pre>

<h3>Server</h3>

<h4>Create a project</h4>
<pre><code class="language-bash">mkdir /srv/git/${PROJECT}.git
cd /srv/git/${PROJECT}.git
git init --bare --shared
</code></pre>

<h4>Share the project with a group</h4>
<p>Create a group and change the group of the project directory:</p>
<pre><code class="language-bash">addgroup ${GROUP}
chgrp -cR ${GROUP} /srv/git/${PROJECT}.git
</code></pre>

<p>Add users to the group:</p>
<pre><code class="language-bash">usermod -a -G ${GROUP} ${USER}
</code></pre>

<h3>Client</h3>

<h4>Configuration</h4>

<p>
Set your name and your email address for all projects:
</p>
<pre><code class="language-bash">git config --global user.name "John Doe"
git config --global user.email johndoe@example.net
</code></pre>

<h4>Basic usage</h4>

<p>Clone a repository via SSH:</p>
<pre><code class="language-bash">cd src
git clone ${USER}@git.example.net:/srv/git/${PROJECT}.git
cd ${PROJECT}
</code></pre>

<p>Edit some files:</p>
<pre><code class="language-bash">${EDITOR} README.md
</code></pre>

<p>Review modifications in files:</p>
<pre><code class="language-bash">git diff
</code></pre>

<p>Prepare a commit by adding modified files:</p>
<pre><code class="language-bash">git add README.md
</code></pre>

<p>Review the set of changes by listing changed files:</p>
<pre><code class="language-bash">git status
</code></pre>

<p>Commit the changes with a short message:</p>
<pre><code class="language-bash">git commit -m "Improve description about the project"
</code></pre>

<p>Push the commits to the remote server:</p>
<pre><code class="language-bash">git push
</code></pre>

<h3>Workflows and Branching Strategies</h3>
<p>
Especially, when working in a team of developers, <br />
you will make your thoughts on how to efficiently work together.
</p>
<p>
Many workflows and branching strategies already exist.<br />
Here are a few popular workflows:
</p>
<dl>
<dt>Git flow</dt>
<dd>
<a href="https://jeffkreeftmeijer.com/git-flow/" target="_blank">
https://jeffkreeftmeijer.com/git-flow/</a><br />
<a href="https://nvie.com/posts/a-successful-git-branching-model/" target="_blank">
https://nvie.com/posts/a-successful-git-branching-model/</a><br />
<a href="https://github.com/nvie/gitflow" target="_blank">
https://github.com/nvie/gitflow</a>
</dd>
<dt>GitHub flow</dt>
<dd>
<a href="https://docs.github.com/en/get-started/quickstart/github-flow" target="_blank">
https://docs.github.com/en/get-started/quickstart/github-flow</a>
</dd>
<dt>GitLab flow</dt>
<dd>
<a href="https://docs.gitlab.com/ee/topics/gitlab_flow.html" target="_blank">
https://docs.gitlab.com/ee/topics/gitlab_flow.html</a>
</dd>
</dl>

<h3>External Links</h3>
<ul>
<li><a href="https://git-scm.com/" target="_blank">
https://git-scm.com/</a></li>
<li><a href="https://git-scm.com/book/" target="_blank">
https://git-scm.com/book/</a></li>
</ul>