This may be a question about convention, best practices and/or personal preferences:
So I'm a git noob, and my website code is not worth sharing, so I'm not using github or the like.
Knowing that git doesn't need a central repository I thought : great, my workstation and the server are the two nodes, and I'll just push changes from my workstation to the server.
When I started, the code was only on the server, so I:
- On server : git init
- On workstation : git clone me@myserver:path/to/repo
- Merrily made changes and committed locally
- On workstation : git push me@myserver:path/to/repo
I got strange results. The files I had added locally appeared on the server, but changes to existing files weren't reflected.
I then read a warning against pushing to a remote branch that is checked out. So the new setup is:
- Ran git clone --bare to make a bare repository
- Put the bare repository on my server (~/repos/mysite.git - not a public folder)
- Code local and : git push me@myserver:repos/mysite.git
- On server : git pull ~/repos/mysite.git to get the latest
Is this correct? Is it logical? Is it what you would do?