Project

General

Profile

Git Workflow » History » Version 10

Alexander Watzinger, 2019-11-05 16:39

1 1 Alexander Watzinger
h1. Git Workflow
2
3
We are using "git":https://git-scm.com/ as a versioning system using the "Git Branching Workflows":https://git-scm.com/book/en/v2/Git-Branching-Branching-Workflows
4
5 6 Alexander Watzinger
h2. Main branches
6 1 Alexander Watzinger
7 5 Alexander Watzinger
* *master* - the stable version used in productive environments. It is the latest release version which is tested and, to our knowledge, bug-free.
8 1 Alexander Watzinger
* *develop* - here the latest development branches are joined when they are finished. At a release the develop branch is merged into the master branch.
9
10 2 Alexander Watzinger
The branches in which the work (in progress) is happening have following prefixes:
11 1 Alexander Watzinger
12
* *feature_* - e.g. feature_user_profile_images
13
* *fix_* - e.g. fix_map_bug
14
15 3 Alexander Watzinger
When work on these branches is finished they are merged into the *develop* branch. Around once a month a new version is released where the *develop* branch is merged into the *master* branch.
16 1 Alexander Watzinger
17 6 Alexander Watzinger
When working on a new feature it's a good workflow to begin from the *develop* branch and merge it regularly to keep merge conflicts to a minimum.
18 1 Alexander Watzinger
19 6 Alexander Watzinger
h2. Database changes
20
21
If there are database changes make sure that 
22
23 8 Alexander Watzinger
* there is a comment with the issue number at the SQL update script (e.g. at install/upgrade/3.12.0.sql)
24 6 Alexander Watzinger
* that the issue is noted at util/changelog.py
25
26
That way it's easier to deal with updates in the *develop* branch when dealing with multiple new features which need database updates.
27 9 Alexander Watzinger
28
h2. Useful git configurations
29
30
These options can be configured in your global git config file e.g. ~/.gitconfig on Linux:
31
32
<pre>
33
[user]
34
        name = Your Name
35
        email = your@email.net
36
[color]
37
        ui = true
38
[core]
39
        editor = vim
40
[fetch]
41
        prune = true
42
[merge]
43
        tool = meld
44
[mergetool]
45
        keepBackup = false
46
[status]
47
        showUntrackedFiles = all
48
</pre>
49
50
Or using shell commands e.g.
51
52
<pre>
53
git config --global fetch.prune true
54
</pre>
55 10 Alexander Watzinger
56
57
h2. Prompt with branch and dirty
58
59
<pre>
60
vim ~/.bashrc
61
</pre>
62
63
<pre>
64
function parse_git_dirty {
65
    [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" 
66
}
67
function parse_git_branch {
68
    git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" 
69
}
70
PS1='\[\e[1;34m\]\u@\h:\w\[\e[0;32m\]$(parse_git_branch)\[\e[1;34m\]\$ \[\e[m\]'
71
</pre>