简体   繁体   中英

Visual Studio Community Run command after git commit

every time I do a git commit I want to catch the repo log to a file, I want to publish the commit log to my website (internal page).

The git command is

git log --since='01-01-2019' > "$(ProjectDir)\Content\CurrentCommit.txt"

Because I don't know how to execute it after commit what I'm doing is to execute it at after build but I don't like it because it takes time and delays the program execution (and it isn't necessary to do it every time)

在此处输入图片说明

Any Idea?

Look at post-commit git hook . This is intended to be used for notification about commit. Hooks are located under the .git/hooks folder in your repo

You can use a git hook (specifically in this case, a post-commit hook) to run your command. Place your command in the file .git/hooks/post-commit :

#!/bin/sh
git log --since='01-01-2019' > "Content/CurrentCommit.txt"

You might need to adjust the directory of the file. The working directory of the git hook will be your repository root.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM