Using someone else's project
Suppose you want to use someone else's source code. You could just
download a file from his web site, or maybe a tar.gz
-type
archive. But maybe you want to keep up-to-date with the latest version
of this code, and maybe you are interested in seeing the history of
the code, the detailed changes introduced when you get a new
version. In this case, you can do something more convenient than
downloading a tar.gz
-type archive: you can "clone" locally the
remote Git repository you are interested in.
For example, go to the toy project page created for this course. There is a download button, but there is also a "Clone" button, which tells you what addresses you can use. Use the https address:
git clone https://gitlab.in2p3.fr/guez/toy.git
Note that this does not require any login as long as the owner of the
project has declared the project to be public. You then get the
complete repository, with all its history, not just the last
version. You can use all the local Git commands on it: git log
, git
diff
, git status
etc. Note that these commands tell you about the
local state of your repository, they do not connect to the remote
repository.
If some time later you do not remember where you got this directory from, the following command will tell you:
git remote -v
When you want to get an up-to-date version of the code, assuming you did not make any change to it yourself, just type:
git pull