简体   繁体   中英

How to commit remote files on git pull?

The problem:

There is a php script on my server changing some files in a dir called "example/". This changed files are "uncommitted", ok. So, to bring this changes I need to:

  • login in the server
  • go to site directory
  • set git bare=false
  • add and commit all
  • set bare=true
  • finally git pull the changes to work in local!

This is a very boring work and I would to know if there is a way or script to do it automatic. Maybe the git hooks could help to do this tasks but I can't find anything about this problem.

Or (if exists) some git command to remote update from local.

Sorry my english. ^^

If it's your php script, and/or you have access to change it, you could just edit the script to commit the changes.

Otherwise, depending on your server platform, you could add a cron job (or scheduled task (Windows) etc) and write a new script to periodically commit changes.

As far as I know, git hooks don't apply here because the working directory is just being changed by the php script, which isn't actually a git function.

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