Edit your site with git. How to build a job?

To use GIT started a couple weeks ago, goal is a version control system.
Made this statement https://github.com/eveness/git-and-timeweb

The problem is that I used to edit project files in Sublime Text and directly via SFTP to change them on the serverwhen I see that everything is done as needed, doing add + commit locallyand send it to the server, but since files have been modified directly on the server, a conflict occurs.

If you edit the files locally and send changes only after add + commit the conflict there.
That would work so it is necessary to raise a local web server, and it is not convenient.

Tell me, how do you work with projects?
It is important to me that you could edit the files on the server directly, and have the opportunity to committing the changes locally.

With the site running at the same time strictly one person.
March 19th 20 at 08:42
7 answers
March 19th 20 at 08:44
Solution
Solved your problem:
  • At the remote site doing "git init"
  • Then get via SSH "clone" copy to local computer
  • Additionally, make the "push" of the project on GITHUB (just in case)
  • Work with the website using SublimeText + SFTP (local edits immediately go to the website)
  • Locally monitor changes through SublimeMerge
  • When you realize that on the website everything works as it should, on the remote server detecting changes in git
  • Local changes and remove or hide using stash (at desire it is possible to clean "git reset --hard" + "git clean-f-d")
  • Get "pull" changes from a remote server, make a push on GITHUB (just in case)
  • If you did stash - stash pop make, and the fact that it came via pull, perfectly placed on stash pop, because it's the same thing

I've managed to do this: make quick edits and have the ability to rollback in case of errors.
I understand that my method is contrary to logic and the idea of GIT, but for me, at the moment, it fits. Thank you for your answers and advice.
With a remote server for development, too, did almost the same scheme. Invented as better.
It would be easier with a local server, but that's another story :) - davon commented on March 19th 20 at 08:47
March 19th 20 at 08:46
Tell me, how do you work with projects?

it is necessary to raise a local web server
it is not convenient.

what's not convenient? it is inconvenient to do this:
to edit the project file in Sublime Text and once via SFTP to change them on the server
to edit the project file in Sublime Text and once via SFTP to change them on the server

Especially someone else has updated a file in front of you. That's straight chic situation. - Elliot.Quigley commented on March 19th 20 at 08:49
I'm sorry, not once wrote: the only edit I website.
Plugin for SublimeText SFTP sends a file to the server immediately after you save the inconvenience of no. - Keegan_Douglas77 commented on March 19th 20 at 08:52
@Keegan_Douglas77, you people say it, believe me. To edit files on the fighting server not only unprofessional, but dangerous. "Be prepared for unforeseen consequences." - Isabel11 commented on March 19th 20 at 08:55
March 19th 20 at 08:48
Locally normally tested in the container stable version deploy to the server. You can, again, container.

You can automate the delivery of code to the server, for example using the free repository networks and networks ci.
Github also offers several free ways to test, collect and depoit small projects.
March 19th 20 at 08:50
I do not want and will not raise the local server. - Keegan_Douglas77 commented on March 19th 20 at 08:53
@Keegan_Douglas77article about this word, but only that on the server it is better to have two repository than one. - Lila_Frami commented on March 19th 20 at 08:56
@Lila_Frami, tell me if not difficult, why make a bare repository, and that rule is:
One of the basic rules when working with Git — never make a push in repostiry who has a working copy.

What is it supposed to be obvious, if still infusion will be performed in bare hooks that will change the files in the Prime repository? If only in the fact that by default, Prime will not make him a push, but this can be changed in the settings. - Keegan_Douglas77 commented on March 19th 20 at 08:59
March 19th 20 at 08:52
On the server nothing is wrong. The exception may be some hot-hot-hot fix, although I'm not sure how this is correct - then you can do git stash (once fixed in repo). In other cases - use local server, and test absolutely everything on the LAN.
March 19th 20 at 08:54
Create a local server environment in Vagrant or Docker there and test. When a new developer he will need to run your container and immediately you will be able to work locally.

For deployment to the server, you can use different designed for this softiny, their huge Kol-in: Jenkins, Travis, TeamCity, TFS etc. you Can of course in cron every minute to push git pull :) But still better to take, for example, Jenkins. As Bitbucket, github and networks provide it for these purposes with instructions on how to configure.

PS: Take at this stage and vagrant image for your tasks - it is easier to understand and configure, then you can already in the side of the dock to watch.
March 19th 20 at 08:56
Can raise on the samba server and rule all as though locally in the network drive. I have made so writing code is essentially directly on the dev server.
So the SFTP plugin makes it all very quickly and without Samba ;) - Keegan_Douglas77 commented on March 19th 20 at 08:59

Find more questions by tags Web DevelopmentSublime TextGitHubGit