Project

General

Profile

Downloading and modifying anniesoft packages » History » Version 13

« Previous - Version 13/17 (diff) - Next » - Current version
Tian Xin, 02/12/2016 09:48 AM


Downloading and modifying anniesoft packages

1) Create the directory you want the code in:

mkdir My_package-name

2) go into the directory

cd My_package-name

3) initialize git

git init

4) set up the "remote" "origin" of the code to be the website of the git package

git remote add origin ssh://p-[project-name]@cdcvs.fnal.gov/cvs/projects/[package-name]

where

[project-name] =  anniesoft OR lappd-response OR mcpreco OR tamora OR wchsandbox

This tells git where the package is located online. You will refer to the location of the package as "origin" in future commands.

5) Use the "pull" command to download the package to your local area.

git pull origin [branch name]

For now there is only one branch, the master, so you would type

git pull origin master

At this point there will be a local copy of the master (or whichever) branch in MyWChSandBox

Modifying and updating anniesoft packages

To check changes in the local version of the package against the committed version, type:

git status

To commit changes to a file, type:

git commit -m "comments here" [filepath/filename]

To add a new file:

git add [filepath/filename]
git commit -m "comments here" [filepath/filename]

Once you've commit changes, to update the github server, you still need to type:

git push origin [branchname]

Note: you need to define the "origin" if you have not done so (see the downloading instructions above for more details).

Sparse Checkout

Under normal circumstances, sparse checkout will no longer be necessary. This allows you to download a sub-directory of a package in git. But, if you must:

Go through checkout steps 1-4 (above)

git config core.sparseCheckout true

Now you need to define which files/folders you want to actually check out. This is done by listing them in .git/info/sparse-checkout, eg:

echo "some/dir/" >> .git/info/sparse-checkout
echo "another/sub/tree" >> .git/info/sparse-checkout

Then finish with checkout step 5 (above).