Project

General

Profile

GIT basics for PPFX

(For committing a new or modified file to the remote repository)

Getting the code from the remote repository:

git clone ssh://p-ppfx@cdcvs.fnal.gov/cvs/projects/ppfx

Local Workflow:

There are three stages in the local workflow: the working directory, the staging area and the HEAD.

  • Adding a file from the working directory to the staging area
    git add <file name>
    

    You can add many files or everything (using *)
  • Removing a file in the staging area
    git rm <file name>
    
  • Committing a new/changed/removed file to the local HEAD:
    git commit -m "commit log" 
    

Pushing changes to the remote repository:

Run:

git push origin master

Updating:

If you want to update your local repository:

git pull

Repository history:

You can get the repository history by running:

git log

Working with branches:

Create and push your branch:

git checkout -b [branch_name]
git push origin [branch_name]

Move to your branch:

git checkout [branch_name]

List branches and know which branch you are:

git branch

List all available tags:

git tag

Commit to your branch:

git [add and commit as usual] 
git push origin [branch_name]