This page describes how to work with git in a pretty way.
Commit messages are a hugely important part of working with git. They not only help other workers to understand changes quickly, but also are the basement for new releases and their release notes. Thus, these following rules cited from here should be accounted in commits.
First of all, commits should be atomic
.
One commit should contain only changes of a few lines of code (or one single feature).
This method seems to be too verbose and kind of annoying, but when working with Git logs (git log
) or GitHub's network tree, this is a huge advantage.
Branch management, releases and especially finding bugs is way easier with small commit messages.
In summary, a properly formed Git commit subject line should always be well structured, start with a verb and informative.
Besides that, it depends on your personal taste.
A commit message could base on completing the following sentence:
This commit will <subject line>
Alternatively, you could use third person:
This commit <subject line>
In the following suggestions, the first version is used.
-
Separate
subject
frombody
with a blank line. The body explains what has changed and why, not how it has changed. How can be checked by looking at the commit changes itself. -
Line widths
- 1st line (
subject
) up to 50 characters - 2nd line empty
- Remaining (
body
) lines up to 72 characters
- 1st line (
-
Uppercase the
subject
line- fix typo ... + Fix typo ...
-
Do not end the
subject
line with a period- Refactor brackets of some if-statements. + Refactor brackets of some if-statements
-
Use the present tense
- Added feature ... - move cursor to ... - fixed bug ... - sweet new API methods ... + Add feature ... + Move cursor to ... + Fix bug ... + Add new API methods for ...
-
Be informative!
- Add build-feature + Add script to build xyz automatically
Consider using following verbs/flags in commit messages:
fix
when the commit contains bug fixesdoc(s)
when writing documentationtest(s)
when tests were changed/addedstyle
when code or format style changes occur in the commitrefactor
when changes DO NOT change functionality
This project uses Gitflow Workflow, a nice and clear way to work effectively.
This means following branches are used:
master
: the official release (using tags) (EDIT: replaced bynightly
)develop
: branch for active developmentrelease/<tag>
: temporary branch offdevelop
for bug fixes and docs before getting merged intomaster
feature/<name>
: branches for specific feature developmenthotfix/<name>
: branches for bug fixes branched offmaster
fix/<name>
: branches for bug fixes branched offdevelop
Following the rules of this, the master
only contains releases and is only merged --no-ff
.
Although it feels a bit redundant due to the nice feature-branch concept, this helps publishing clean releases and maintaining a clean git history.
Further, it helps keeping in mind that master
should always run without errors.
Quelle: stackoverflow
To remove a submodule you need to:
- Delete the relevant section from the .gitmodules file.
- Stage the .gitmodules changes
git add .gitmodules
- Delete the relevant section from .git/config.
- Run
git rm --cached 'path/to/submodule'
(no trailing slash). - Run
rm -rf .git/modules/path/to/submodule
- Commit
git commit -m "Removed submodule 'name'"
- Delete the now untracked submodule files
rm -rf 'path/to/submodule'