-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Git Commit Hygiene
Stefan Profanter edited this page Sep 29, 2016
·
11 revisions
The open62541 project uses the following Git Workflow:
- There are different types of branches:
-
0.2
current stable release branch. Everything that happens on this branch before release is also merged into master. After release, new development only happens on master, while bugfixes are cherry-picked into this branch. This is the default branch -
master
for development of new features not yet ready for stable-release -
feature/description_of_feature
new bigger features should always be pushed to a feature branch for review by other developers. When the feature is ready to be used by other developers, the feature branch is merged into master and then deleted. -
hotfix/description_of_hotfix
hotfixes which should be reviewed by other developers or merged into multiple branches (e.g. into master and stable release). When the hotfix is merged, the branch should be deleted
-
- Use (local) branches when working on multiple features in parallel. Don't mix features/topics in fruit-salad commits.
- Set remote branches to
git pull --rebase
automatically usinggit config --global branch.autosetuprebase always
. Individual branches can be set usinggit config branch.<branch>.rebase true
. This prevents these additional "Merge branch 'master' of https://github.com/acplt/open62541" commits from being introduced. - Use
git add -p <filename>
to select only those changes in files that are really required for the commit. - Use
git rebase -i <commit-hash>
to interactively combine selected (local) commits into one commit. Especially apply cleanup fixes like "repair broken testing" silently before pushing. Withgit rebase -i HEAD~3
the scope is on the last 3 commits of the branch. Do this also before pushing a review request to master. - Read popular best practices on the interwebs. Such as
git checkout gh-pages
git reset $(git commit-tree HEAD^{tree} -m "squashing gh-pages to reduce repository size")
git push --force