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 Tuesday, March 13, 2018 at Davis Library.
Prerequisites:
Slides:
$ 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.) |