Do the following.
Suppose your project on the server is in the folder /var/www/projeto
. Clone your repository into another folder, for example, /var/www/projeto_git
:
git clone <repositório> <pasta de destino>
The branch that will be cloned will be the standard master
. Create another branch called, for example, servidor
:
git checkout -b servidor
Then copy all files from your project folder to your repository:
cp -R /var/www/projeto /var/www/projeto_git
This done, Embed the files with a very clear message (e.g., "server files") and send them to the remote server:
git add --all
git commit -m <mensagem de commit>
git push -u origin servidor
That way you’ll have two branches in its repository: the master
, which contains the original design, and servidor
, that has its project modified with the files of the server on which it is hosted.
(Just one detail: Since you don’t have much experience with Git, be careful when viewing files with sensitive information in a public repository; prefer private repositories.)
Finally, if you want to download the modified project in your development environment, run the following command:
git checkout -b servidor origin/servidor
In this way, it is possible to compare the two branches (that is, which files exist in a branch and not on the other) and the differences between files with the command:
git diff master..servidor
Thank you very much Rodrigo. I am now testing this solution and that’s right. I appreciate your willingness to help.
– troV