DEPRECATED

This space is obsolete and unmaintained. The entire content of the DM Developer Guide is now maintained at https://developer.lsst.io .

Skip to end of metadata
Go to start of metadata

Git References

Git has many similarities to other source code version control systems, but there are important differences as well. There are a number of useful references to help you master your use of git

  • git Reference -- read this first to get a high-level overview in 15 minutes

  • Learn.git series -- another git introduction, including screen-casts (note: the text may be somewhat more informative than the embedded screencasts)

  • http://git-scm.com/course/svn.html -- git for svn users (but please, read the links above as well)

  • Pro Git book -- Written by Scott Chacon. Get to know git in more depth (~2 hrs?)

  • Git Book -- similar to the Pro Git book, but a bit more comprehensive

  • Useful git tips -- some useful less well known tips

  • An explanation from Mario Juric of how to think about git and how it internally does things. It also discusses merging and fast-forwards. Note that most of this is covered in the tutorials above, but if you're still confused, try reading it.
  • A video by Phil Marshall on using git and GitHub.

A cookbook style document, Git Crash Course, may help you understand the use of git for LSST/DM code development.

Basic Operations

The following is a summary of basic git operations:

git add

Puts current working files into the stage (aka index or cache)

git checkout

Replaces the current working files with files from a branch.

git checkout -b

Creates a new local branch from the current branch's tip.

git clone

Clone an existing repository into a new directory. 

git commit

Commits staged changes to a local branch

git commit -a

Commits all modified files to a local branch (shorthand for "git add" followed by "git commit" for each modified file)

git fetch

Downloads changes from a remote repository into the local clone

git merge

Merges files from a given branch into the current branch.

git pull

Fetches remote changes on the current branch into the local clone, and merges them into the current working files.

git push

Uploads changes from all local branches to the respective remote repositories.

git reset

Makes the current branch point to some specific revision or branch.

git reset --hard

Makes the current branch point to some specific revision or branch, and replaces the current working files with the files from that branch.

The detailed file status lifecycle is illustrated in the following diagram: 

 

Git_operations.pdf

  • No labels