I am working with a developer that is new to git, and I would like to setup a git workflow that would let me auditing the commits made by this developer (and possibly reject them) without forcing him to rebase his work (which is error prone for new users).
Here is the scenario :
- the
master
branch contains only audited code devel
branch is created by forkingmaster
branch- a developer is working on the
devel
branch and push his code for me to audit - I detect some issues with his code, so I ask him to make more commits on
devel
branch to fix the issue - Once I'm happy with the code, I cherry-pick (or merge with squash) the developers commits on the
master
branch, add my own comments and mark the commit as authored by the developer - The developer merge back the
master
branch into hisdevel
branch
Here is a visual illustration of this scenario :
After this sequence, how can I be 100% sure that mistakes made by the developer during the "make mistakes / redo" sequence will not show up again when the developer will push his devel
branch again after some other commits ?
The best solution would be to ask the developer to rebase his devel
branch against the master
one, but this is a hard task to new git users.
If this workflow is wrong in any way, please suggest me another where I would be able to audit the commits before merging them into the master branch.
EDIT
A friend suggested me a direction that looks promising : the --fixup option when doing commit.
--fixup=<commit>
Construct a commit message for use with
rebase --autosquash
. The commit message will be the subject line from the specified commit with a prefix of "fixup! ". See git-rebase for details.
This option could be used by the developer to properly mark his second and third commits as a fix for his first one. A good solution to explore...