Git
Git is a distributed version control system (VCS).
It is used for source control management (SCM).
Installation
Git is part of the official Debian repository:
apt install git
Server
Create a project
mkdir /srv/git/${PROJECT}.git
cd /srv/git/${PROJECT}.git
git init --bare --shared
Share the project with a group
Create a group and change the group of the project directory:
addgroup ${GROUP}
chgrp -cR ${GROUP} /srv/git/${PROJECT}.git
Add users to the group:
usermod -a -G ${GROUP} ${USER}
Client
Configuration
Set your name and your email address for all projects:
git config --global user.name "John Doe"
git config --global user.email johndoe@example.net
Basic usage
Clone a repository via SSH:
cd src
git clone ${USER}@git.example.net:/srv/git/${PROJECT}.git
cd ${PROJECT}
Edit some files:
${EDITOR} README.md
Review modifications in files:
git diff
Prepare a commit by adding modified files:
git add README.md
Review the set of changes by listing changed files:
git status
Commit the changes with a short message:
git commit -m "Improve description about the project"
Push the commits to the remote server:
git push
Workflows and Branching Strategies
Especially, when working in a team of developers,
you will make your thoughts on how to efficiently work together.
Many workflows and branching strategies already exist.
Here are a few popular workflows:
- Git flow
-
https://jeffkreeftmeijer.com/git-flow/
https://nvie.com/posts/a-successful-git-branching-model/
https://github.com/nvie/gitflow - GitHub flow
- https://docs.github.com/en/get-started/quickstart/github-flow
- GitLab flow
- https://docs.gitlab.com/ee/topics/gitlab_flow.html
External Links
CONTENT.html | source | 2022-06-05 | 3 KB |