Some notes for git

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:

  1. Remove the relevant lines from the .gitmodules file.
  2. Remove the relevant section from .git/config.
  3. Run git rm --cached <path_to_submodule> (with no trailing slash)
  4. The submodule path now appears as untracked.  It is safe to delete.
  5. 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.

This entry was posted in git, Source Control and tagged , . Bookmark the permalink. Follow any comments here with the RSS feed for this post. Both comments and trackbacks are currently closed.