(to be updated)
1. Create the local git repository
Even if you don't plan to use a git server and only store files on your localhost you should create a git repository as early as possible because:
- you will have a file editing history, provided that you'll commit frequently
- it only takes a few seconds to create a git repo
(Note that "git commit" means something slightly different than "svn
commit". Since svn always assumes having a svn server, git can be used
just on your local file system, a git server is not mandatory. Git will
keep track of your changes in his internal database stored in directory
.git by default.
git push would be the equivalent of
that is publishing changes to a server).
Without further ado:
git init# this will create the git database under directory .git from current path
- create file
This contains the list of files that will not be added to git
database. Here's what mine usually contains:
.idea *.pyc settings.py
git add *# to add all files
git commit -a# to commit all files
Read more in the git book.
And GIT for SVN users:
2. Initial server push
Once you have the local git repository you'll want to publish to the git server.
Create the repository on your git server:
cd /var/repos mkdir myproject.git cd myproject.git git init --bare
Add remote server:
sudo git remote add origin ssh://<git user>@<git server>/var/repos/myproject.git
and push your local repository to remote server:
sudo git push -u origin master
Change remote reposistory URL:
git remote set-url origin ssh://new/url