4

I know that I can configure SVN to automatic update the Version in each File Header. but I use Git, and this doesn't support it. Is there any plugin or something else for Vim that do this for me?

Or is there something that updates the time stamp after "Last Modified" in the comment Header of a file which is saved?

Thank you for answering my question, and sorry for my bad English

ZyX
  • 52,536
  • 7
  • 114
  • 135
Ragadabing
  • 472
  • 2
  • 7
  • 14

2 Answers2

2

Why do you want Vim to do it? It is what pre-commit hooks are, see man githooks.

Update: looks like gitattributes are better 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
ZyX
  • 52,536
  • 7
  • 114
  • 135
0

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

xod
  • 589
  • 3
  • 5