Reputation: 31548
I am trying hard to use version control but i am so used to old method of editing files directly via FTP that i am feeling confused what to do. So i am thinking of one solution and please help me with this if its possible or not
I have the user folder in Linux VPS system(Single VPS only)
/home/user/public_html2
Now that will be linked with Http://demo.server.com
.
That directory will be version controlled with repo
in the folder /usr/bin/repo/
so that i can commit the changes.
Now i will have another directory called
/home/user/public_html
which will have the contents updated as the commit is done in /home/user/public_html2
.
That /home/user/public_html
will be linked with http://main.server.com
So that i keep working and editing files in public_html2 via FTP normal and test code as it is but main site is version controlled
Is it possible??
Upvotes: 3
Views: 133
Reputation: 16045
You need a deployment script. Create a script to upload the files to the appropriate locations. Run this script whenever you wish to see your changes reflected on the site. If you wish to maintain two separate locations on a server running different versions, simply add a command line argument to the script to choose which location to upload to.
Use rsync instead of FTP if you can, to avoid transferring unchanged files every time.
Upvotes: 2
Reputation: 6260
When you are using a version control system, why do you need to of to a FTP location to edit the files... It defeats the whole purpose. Rather, checkout the files from the repository into your local machine and after the changes are done, commit the code. If you don't want to use the version while working with the files on your local, simply export the code instead of checkout.
The problem I see from your approach is that the files / directories may go out of sync. Also, if there are multiple users working then this approach would bomb.
I would suggest to have the working copy of the files in your local machine and use them instead of mirroring them to another folder.
Upvotes: 4
Reputation: 39164
Maybe it's possible. But once you start to use version control systems, you should keep accessing your version controlled files through that system. Or better, if you want to access files in "normal way" as you said, then if you access that files without committing any change then it should be ok. But if you want to modify them, you should always pass through your version control system, otherwise you could have problem with file versions.
Upvotes: 3