質問

I have a local development system where I have a Ubuntu-Server VM and I use eclipse in windows host. I develop in eclipse using Remote System Explorer & SSH. I want that whenever I save a file or do some changes in ubuntu-server's /var/www/site-folder it automatically commits and pushes the changes in my git repo. I did try the google but it wasn't much of a help. Any help is appreciated guys. Really wanna improve my workflow.

役に立ちましたか?

解決

This sounds like something you'll have to script. If you save as much as I do (a lot), then you'll end up with a lot of commits. Unless you're careful about when you save, you'll probably end up with a messy history, unless you squash things later.

Are you sure that you want to commit and push automatically every time you save? It also matters whether or not you're pushing to your own private branch or repo.

他のヒント

Actually I think there are use cases where this /is/ a good idea. If you work on two different machines (even not simultaneously), for instance, you cannot share the Eclipse workspace. One simple way to overcome this is to put a bare git repository on a cloud server (dropbox, copy, one drive, etc) and push all work, completed or otherwise, to that everytime you close eclipse.

Will the repo be messy? Sure, but that's not the point.

I could find no easy hooks within Eclipse itself to automate this so I simply put an invocation of Eclipse in a script and finished off with:

git commit -a -m "WIP commit" 
git push origin 

You just have to watch out for newly-created files and remember to add those before you exit.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top