Answer the question
In order to leave comments, you need to log in
How, using Git, while developing in one folder on a VPS, then deploy the results to another folder?
Hello.
I decided for the 100500th time to try to master Git (after all, if so many people have learned to use it, then in principle it is possible, is it logical?)))). I want to start by solving a practical problem - please help me.
1. I am currently developing a project on Laravel. I edit the codes remotely, on a VPS under Ubuntu 18.04, using Notepad++ and WinSCP.
2. Primarily I correct the codes in one folder on one domain, and then, as everything starts to work more or less, I copy the files to another folder (for another domain) on the same server. Sometimes I copy files using mc, sometimes I throw them into a local folder, and then back))
3. Please tell me specific commands for Git that will help me automate this process, and at the same time will allow me to save the key points of the project (I am now doing this in archives). If possible - straight from scratch (I'll install Git myself)))
4. Do I need to use GitHub or its analogues for this?
In general, I want to start with this.
Thank you.
P.S. Based on the conversation below:
The /home/user/deploy folder will be created with a copy of the repository, you can do git pull to update it, but it will be difficult to work there (I won’t go into details now), but this is not required, it’s a deploy. You need to work in /home/user/repo.
Answer the question
In order to leave comments, you need to log in
You need to make it from the folder with the repo to the desired folder for deploy. Git works not only over the network, but also locally. For example, the folder with the repo is located in /home/user/repo, and you need to deploy it in /home/user/deploy:
The /home/user/deploy folder will be created with a copy of the repository, you can do git pull to update it, but it will be difficult to work there (I will not go into details now), but this is not required, this is a deployment. You need to work in /home/user/repo.
The source repo folder (/home/user/repo) can be cloned from Github/Gitlab if that's more convenient. You can make a private repo right on the server, connect via ssh from your home machine, but for this you will need to learn Git a little more :)
Git saves the key points of the project itself when committing. You can always roll back to a commit withgit clone
git checkout {COMMIT_HASH}
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question