R
R
Roman2019-02-24 21:04:09
git
Roman, 2019-02-24 21:04:09

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.

Initially, I did not fully formulate the task: in fact, I need to be able to work in both folders, fully .
Let's put it this way: the results of one folder are visible to the customer from the web - we coordinate details and edits on it, and in another folder I am purely developing. But sometimes, I have to edit in another folder, the one for the customer - when these are minor changes that I make right in the course of discussion in real time.
And now I somehow want to synchronize and automate all this economy, so as not to drag these files back and forth with my hands, forgetting exactly where I made the last edit)))
I understand that Git was created just for this :)
In principle, I can also do this through GitHub, using it as an intermediary (if necessary) - now the main thing for me is to understand what exactly I need to enter and do where))))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yar Rick, 2019-02-24
@procode

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 question

Ask a Question

731 491 924 answers to any question