This guide provides additional resources to supplement the hands-on Intro to Git Workshop offered at the UNC Libraries: learn how to use Git, one of the most popular version control systems in the world. You don't have to be a developer to git started!
The last workshop was taught on Wednesday, October 3, 2018 at Davis Library Research Hub.
- Git Intro: This slide deck was presented during the 10/3/2018 git intro workshop. Exercises are adapted from Library Carpentry's Git Intro for Librarians lesson.
$ git config --global user.name "Mona Lisa"
Sets your username in Git; can be different than GitHub username
$ git config --global user.email "example@example.com"
Sets your email address in Git; should be same as GitHub email address so GitHub can associate your commits with your account
$ git init
Turns any folder into a Git repository
$ git clone https://github.com/
username/
repo-name.git
Copies an existing repository to your computer
$ git remote add origin https://github.com/
username/
repo-name.git
Links your local repository with your remote repository
$ git status
Returns status of changed files in your git repository
$ git add index.md
Adds changes made to a given file or set of files (index.md in this example) to your staging area
$ git commit -m "Add index.md"
Saves a snapshot of changes with a summary message
$ git push origin master
Syncs commits from your local repository up to your remote repository
$ git log
Returns list of local commits, or a history of saved snapshots
$ git pull origin master
Syncs commits from your remote repository down to your local repository
$ git diff
View unstaged changes made to all files in your git repository
$ git remote add upstream https://github.com/
original-owner/
original-repo-name.git && git pull upstream master
Syncs your forked repository to the original repository. For more information, see GitHub's Configuring a remote for a fork.
- Learn Git on CodeAcademy
- Git Training and Tutorials on Lynda.com (free access provided via UNC onyen-login)
- SourceTree: a free Git GUI that offers a visual representation of your repositories without having to use the command line
-
Library Carpentry: list of available lessons created by the Library Carpentry community, which provides software and data skills training aimed at the needs and requirements of library professionals
-
Markdown Cheatsheet: quick reference for Markdown language
-
- GitHub's Git Cheatsheet: even more Git commands!
-
- Pro Git book by Scott Chacon and Ben Straub: gives in-depth, but easy-to-understand explanations of version control and the Git workflow