User Tools

Site Tools


git:start

Git

Administrators

  • Git administrators : Kuba Moron, Krzysztof Swientek

Using Git

Help

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

Starting svn/git shell

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:

  • script assumes existence of public/private-key named svn and svn.pub in yours .ssh directory (.ssh/svn and .ssh/svn.pub)
  • script doesn't have any significant dependencies you may copy it to you workstation and use it
  • script source is in svn : cds_etc/trunk/etc/svn_scripts/svnshell

Getting repository

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 

Update/Pull

To download most recent version form repository use:

 git pull

Adding

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.

Committing

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"

Sending to server

To send all your commits to server use

 git push 

Deleting

To remove resource (file / directory) use:

 git rm file 

Reverting

To cancel your changes (revert to file version remembered in repository) use:

 git checkout -- file 

Checking status

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 
/services/www/http/wiki/data/pages/git/start.txt · Last modified: 2019/12/03 12:38 by krzysztof.swientek