Table of Contents
Commit bef50e5d86d45707806f5733695a229f3e295b1a
[one blank line]
Description
In this case, the commit will be merged into the master branch with the following process.
$ git checkout master
$ git pull
$ git checkout
$ git rebase master
$ git checkout master
$ git merge
Keeping Commit History
Sometimes, having logically separated, multiple commits for a single task helps developers to grasp the logical process of the work that had been done for the task. If the commits are merged with fast-forward strategy, the commits will not be grouped together. Therefore, to group the commits, create an explicit merge commit.
In this case, the commits will be merged into the master branch with the same process above except the last step (step 7).
For the last step, the local task branch will be merged into the local master branch with an explicit merge commit by running the following command. If you omit --no-ff option, the command will do fast-forward merge instead.
$ git merge --no-ff
The above process will result, for example, the following commit history. (This is captured from apache/incubator-age.) There is an explicit merge commit, 69f3b32. Each explicit merge commit groups related commits.
* 9779a0b Implement property and element access operators * 69f3b32 Implement + (concatenating strings) operator |\ | * ab50b5c Support Floating Point Precision in String Operators | * cceebcd Implement String Operators |/ * 6c36b80 Fix failed assertion when agtype_build_map() takes agtype as key * 304bc68 Refactor bool_to_agtype()
Note: There is no commit between an explicit merge commit and the parent commit, which is on the master branch, of the explicit merge commit. This is done by doing rebase before merge.
For a full list of coding style guidelines, please refer to the style setup in the clang-format.5 in the AGE git repository.
Use 4 spaces per indentation level. (no tab character)
switch (suffix) {
case 'G':
case 'g':
mem <<= 30;
break;
case 'M':
case 'm':
mem <<= 20;
break;
case 'K':
case 'k':
mem <<= 10;
// fall through
default:
break;
}
The line length limit is 79 columns, except for strings longer than 79 characters.
All braces are on their own line solely. See below.
int function(int x) { body of function }
struct s { int a; int b; }
if (x is true) { we do a } else if (y is true) { we do b } else { we do c we do d }
Braces should be used consistenly for if/else statements, regardless of the number of lines in their bodies. See below.
if (x is true)
{
we do a
if (y is true)
{
we do b
}
else
{
we do c
}
/* Here's an example using do-while */
do
{
body of do-loop
} while (condition);
}
Use the underscore name convention for all variables, functions, structs, enums and define macros.
Use typedef only for struct and enum. It must not be used for pointer types.
For multi and single-line comments, both //
and /**/
can be used.
See below.
/* * This function * does x */ void f(void) { // This is to check... if (y is true) { we do b } /* We need to do this here because of ... */ for (;;) { /* More code here... */ } }
Don't align bodies of macros.
//do this #define Anum_ag_graph_name 1 #define Anum_ag_graph_namespace 2
//not this #define Anum_ag_graph_name 1 #define Anum_ag_graph_namespace 2
When you write a macro that spans multiple lines, don't align \ character.
// do this #define f() \ do \ { \ run(); \ } while (0)
// not this #define f()
do
{
run();
} while (0)
For newlines, only \n is allowed, not \r\n and \r.
If a pointer variable (including List *) is used as a condition, which means that it is evaluated as true/false value, use it AS-IS. Do not perform explicit comparison with NULL (or NIL). For negation, put ! before it.
An error message that is passed to errmsg()
starts with a lower case letter.
An error detail/hint message that is passed to errdetail()/errhint()
starts with an upper case letter.
The documentation is maintained at link. It includes more information on how the documentation workflow works.