Codebots and Git
A codebot commits to a git repository in the same manner a human would.
When a codebot writes code and commits it, it always uses the same git commit message
Re-write target application. The reason for this message is that a bot is always directed by a human in the changes it makes. As far as the bot is concerned, it always performs the same action: writes the code based on the model.
Given a bot is directed by a human, it will attribute any changes made to the person who directed it to write the code (press the build button).
An example of a commit log from a bot will appear as follows:
As can be seen in this commit log, the top three commits where performed by the bot when it re-wrote the code as directed to by Kellie.
The first commit was performed by Codebots, not the bot, and the second from the bottom was a human commit.
Versioning and branching with a bot
Typically, the bot writes code to the
develop branch of a repository. For some versioning and branching policies this may cause issues; as developers we become concerned with how we can trust a branch which can easily change (potentially every time a person presses the build button).
There are many ways of working with this problem. One solution is to create a new branch to allow for the manual management of bot written code and human written code. For this example, this branch will be called
In this flow, we allow the human developers to maintain strict control over the codebase whilst still having the benefits of using a codebot.
Committing to another branch
Alternatively, you can now direct the bots to build to a different branch. By clicking on the down arrow on the build buttons, you can select an additional option labelled “build to git branch”. This allows you to nominate which branch the bot builds to.
This can be risky however, as you can’t use that branch in the traditional sense to focus on developing new features; currently, the models are not able to be branched, meaning that you still are restricted to only having one consistent branch for building to. This feature is more to allow you to nominate a different branch instead of
develop, as we understand that many people have their own uses of the
develop branch and would rather funnel the changes elsewhere.
If you want to use this feature, we would recommend (as above), to create a branch specifically for bot-commits, which you can then merge into other branches as required.
The Platform will not automatically build to that branch every time you re-build. You will need to use the dropdown any time you want to build to that branch, though it will remember which branch you used most recently and have it pre-filled in the field.
Was this article helpful?