Automatic version update using Vim; without SVN, I use Git

I know that I can configure SVN to automatically update the version in each file header. but I use Git and this does not support it. Is there any plugin or something else for Vim that does this for me?

Or is there something that updates the timestamp after โ€œLast Modifiedโ€ in the comment The title of the file that was saved?

Thanks for answering my question and sorry for my poor english

+4
source share
3 answers

Why do you want Vim to do this? This is what happens with commit before commit, see man githooks .

Update : it seems that gitattributes is the best option for this:

 cd /path/to/repo echo "*.php filter=lastmodified" >> .gitattributes cat >> .git/config << EOF [filter "lastmodified"] clean = "sed -r -e 's/(.{,10}Last Modified:).*/echo \"\\1 `date +%F`\"/e'" EOF 
+2
source

This question has already been asked in the bazaar and id . It comes down to the fact that "$ id $ is not related to DVCSes." For alternate constructs, check moving-from-cvs-to-git-id-equivalent .

+2
source

In a recent project, I used a small script that generated a version file based on git describe --tags , which would be included in the build process. If you don't need to compile your stuff, you can also update the file in a git post-commit script (and put this file in .gitignore).

0
source

Source: https://habr.com/ru/post/1343458/


All Articles