Key Points
What is Git/GitHub? |
|
Getting started with Git |
|
Sharing your work |
|
Review |
|
GitHub Pages |
|
Quick reference
Navigating the shell
pwd
- print working directory
ls
- list directory :
-
-l
: list file information
-
-lh
: list human readable file information
cd
- change directory
Interacting with files in the shell
mkdir
- make directory
cat
- send file or files to output (in most cases, print to shell)
head
- output first parts of a file or files
tail
- output last parts of a file or files
mv
- rename or move a file or files. Syntax for renaming a file:
mv FILENAME NEWFILENAME
cp
- copy a file or files. Syntax:
cp FILENAME NEWFILENAME
>
- redirect output. Syntax with
cat
:cat FILENAME1 FILENAME2 > NEWFILENAME
rm
- remove a file or files. NB: USE WITH CAUTION!!!
Git commands
Git cheat sheet handouts:
git init
- create a new local git repository
git status
- view the status of your files in the working directory and staging area
git add
- tell git to start tracking a file, or a series of files
git commit
- save file changes from the staging area permanently to the project history
git push
- upload all commits to a remote repository, such as GitHub
git log
- show history of commits in reverse chronological order
git diff
- show changes made to tracked files
git pull
- download upstream changes and merge them into your local repository
git remote add origin
- add a remote repository named ‘origin’, to upload changes to or download changes from
Useful library GitHub repositories
- DavidChouinard/mrc_to_csv: ‘Python script for converting MARC21 files to a saner format (CSV), originally designed for the Harvard Libraries MARC21 records’
- Process MARC records from Python
- https://pypi.org/project/pymarc/
- umd-mith/git-intro: high level intro to git
- edsu/mirador
- edsu/microdata
- dhtaxonomy/TaDiRAH
- OpenAPC/openapc-de
- JiscMonitor/allapc
- Python Programming for Humanities
- Code4Lib 2008 lightning talk – Git and distributed cataloging
- Open Science Guide
Further reading
- The help pages of GitHub are a good place to start
- GitHub has ‘activities’ which aim to explain how git works
- GitHub also has interactive tutorials for their online version (Learning Labs) and for using Git offline (Git-It)
- Atlassian has in depth but clear tutorials on using git
- The Programming Historian uses GitHub to manage lessons useful to historians and also people working in libraries. It is a useful resource for lessons but also to see GitHub in action.