E
E
Evgeny Osipov2019-03-26 18:35:54
git
Evgeny Osipov, 2019-03-26 18:35:54

Website editing + git. How to arrange the work correctly?

I started using GIT a couple of weeks ago, the goal is a version control system.
I did it according to this instruction https://github.com/evenness/git-and-timeweb
The problem is that I'm used to editing project files in Sublime Text and changing them on the server immediately via SFTP , when I see that I did everything right, I do add + commit locally , I send it to the server, but because files were corrected directly on the server, there is a conflict.
If you edit files only locally and send changes only via add + commit , then there is no conflict .
To make it work like this, you need to raise a local web server, and this is not convenient.
Tell me, how do you work with projects?
It is important for me that it would be possible to edit files on the server directly, and at the same time be able to commit changes locally.
Only one person works with the site at a time.

Answer the question

In order to leave comments, you need to log in

7 answer(s)
E
Evgeny Osipov, 2019-03-26
@Medik18

Solved my problem like this:

  • On the remote site I do "git init"
  • Then I get a copy via SSH "clone" to the local computer
  • Additionally, I do a "push" of the project on GITHUB (just in case)
  • I work with the site using SublimeText + SFTP (local edits immediately go to the site)
  • Track changes locally with SublimeMerge
  • When I understand that everything is working as it should on the site, I commit changes to git on the remote server
  • I delete local changes, or hide them via stash (if you wish, you can clean "git reset --hard" + "git clean -f -d")
  • Get "pull" changes from remote server, push to GITHUB (just in case)
  • If I did stash, I do stash pop, and what came through pull fits perfectly with stash pop, because This is the same

What I achieved with this: I make quick edits and have the opportunity to roll back in case of errors.
I understand that my method goes against the logic and the very idea of ​​GIT, but for me, at the moment, it fits. Thanks for the replies and advice.

A
Anatoly Medvedev, 2019-03-26
@balamyt92

Tell me, how do you work with projects?

you need to set up a local web server
what's not convenient about that? it's inconvenient to do this:
edit project files in Sublime Text and immediately change them on the server via SFTP

D
Dmitry Shitskov, 2019-03-26
@Zarom

Locally they are usually tested in a container, a stable version is deployed to the server. You can, again, a container.
You can automate the delivery of code to the server, for example, using the free gitlab repository and gitlab ci.
Github also offers several free ways to test, build, and deploy small projects.

D
Dmitry Chashchinov, 2019-04-04
@kudesa

https://habr.com/en/post/127213/

A
Alex Wells, 2019-03-26
@Alex_Wells

Nothing is correct on the server. An exception could be some hot-hot-hot fix, although I'm not sure how correct this is - then you can do a git stash (after it was fixed in the repo). In other cases, you use a local server, and you test absolutely everything on the local.

S
Sergei Iamskoi, 2019-03-26
@syamskoy

Create a local server environment in Vagrant or Docker and test there. When a new developer appears, he will only need to start your container and will immediately be able to work locally.
To deploy to the server, you can use different softwares designed for this, there are a huge number of them: Jenkins, Travis, TeamCity, TFS, etc. You can, of course, cram every minute git pull into cron :) But it’s better to take, for example, Jenkins. Bitbucket, github and gitlab also provide this for this purpose with instructions on how to set it up.
PS: At this stage, take vagrant and a ready-made image for your tasks - it is easier to understand and configure with it, then you can already look towards the docker.

B
bro-dev, 2019-03-27
@xPomaHx

You can raise it on a samba server and edit everything as if locally on a network drive. At me so it is made I write the code as a matter of fact at once on a dev server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question