It goes without saying that the book exists to be a source of information and assistance for GIT users new and old. Conveniently, though, the GIT command-line is self-documenting, alleviating the need to grab a book off the shelf (wooden, virtual, or otherwise). The git help command is your gateway to that built-in documentation:
$ git help
or for particular command
$ git help COMMAND
Before you start using git you have to start svnshell. It's not a mistake. You really should run svnshell to work with git! The main function of this script is to simplify key management, you will be asked only once to enter yours pass-phrase at script startup (if you don't like this script you may configure your ssh client in different way). Script is pre-installed on all production servers (koi, ibm). To start shell, just type:
svnshell
You should see modified prompt :
[SVN] promt$
Notes:
.ssh/svn
and .ssh/svn.pub
)svn : cds_etc/trunk/etc/svn_scripts/svnshell
To get local copy (clone) of repository :
git clone git@asic.fis.agh.edu.pl:REPOSITORY_NAME
or optionally to have different local directory name
git clone git@asic.fis.agh.edu.pl:REPOSITORY_NAME LOCAL_DIRECTORY_NAME
If you have local definition of asic server IP (most of machines) a short version will also work
git clone git@asic:REPOSITORY_NAME
To download most recent version form repository use:
git pull
To add new resource (file or directory) use:
git add file
NOTE: Be careful, adding directory means adding directory itself and all files inside it.
NOTE: In fact this command only adds the files to next commit, so you can put here a new or already tracked files.
In Git all commits are local, so after committing you should send your data to server.
To commit (remember) yours changes use:
git commit
NOTE: It will remember only files added to commit by git add
You can commit all changed files (already tracked by git) without using git add by:
git commit -a
You may also commit only specific resource:
svn commit filename
In addition you may provide commit comment from command line using -m option:
git commit -m "comment to my commit"
To send all your commits to server use
git push
To remove resource (file / directory) use:
git rm file
To cancel your changes (revert to file version remembered in repository) use:
git checkout -- file
To check the status of your local repository copy use
git status
To check changes done by you and other users do
git log
or in graphical form
gitk