leinoaa
leinoaa

Reputation: 3

Are commit templates supported on DevOps?

I know that on Git in general it is possible to enable commit templates by modifying the git config file in the .git-folder. But as these folders are hidden in DevOps is this possible or even recommended in DevOps? If it is doable on DevOps is the process different?

In Git the process should be, modify git config to include:

[commit]
  template = ~/.gitmessage

Upvotes: 0

Views: 1244

Answers (2)

Vito Liu
Vito Liu

Reputation: 8298

Agree with Tomasz, It is default git behavior, it's not Azure DevOps specific.

As a workaround:

  1. Enable branch policy, it will reject developers push changes directly to the protected branches. Developers need create pull request to push the changes.
  2. Configure pull request template file.
  3. Update repo and create pull request to push changes.
  4. Use pull request template to update the pull request description.

Then we can check it in the commit details.

Result:

enter image description here

Upvotes: 2

Tomasz Kaniewski
Tomasz Kaniewski

Reputation: 1195

It is not possible to edit .git/config file and store it in the remote repo, for everyone to clone it.

You can include instruction in ReadMe on your repo to change a config with

[commit]
  template = ~/.gitmessage 

once someone clones it.

Upvotes: 1

Related Questions