I switched from Perforce to git for personal projects a while back and these were some notes I jotted down as I was getting going.
Once I had my project going, I wanted to clone it to a bare repository:
git clone --bare project_name
…and then copy it to my server:
scp -r project_name.git john@governor:repos
I cloned it back so the source would reside on the server.
git clone john@governor:repos/project_name.git
I had some submodules in the project I was working on, this is how I dealt with them:
git submodule add john@governor:repos/project_name.git project_name
Getting submodules:
git submodule init git submodule update
Removing submodules:
I have had success with the following procedure, posted here on Stack Overflow:
- Remove the relevant lines from the .gitmodules file.
- Remove the relevant section from .git/config.
- Run
git rm --cached <path_to_submodule>
(with no trailing slash) - The submodule path now appears as untracked. It is safe to delete.
- Commit.
For day-to-day work, keeping the server up-to-date:
git push git pull
When I’m done with my commits, I issue a git push
to update the server. This is the same server I’ve blogged about many times before. Mirrored drives, rshapshot backups — a good place to store things I don’t want to lose.