View on GitHub

NEH Institute materials

July 2017

Home | Admin | Week 1 | Week 2 | Week 3 | Misc

Git tutorial part 2

Using a central repository for a project

Git central repository

Forking repositories

Git forking repositories

$ git remote -v
origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)

$ git remote add upstream https://github.com/Pittsburgh-NEH-Institute/Institute-Materials-2017

$ git remote -v
origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)

Pull requests: making changes and submitting a pull request

How to work with branches

What you think Git is:

Git branch simplified

What Git really is:

Git branch real life

Command Description
git branch -a Show all the branches in your local repository
git branch -a -v Show all the branches and their last commits
git branch <name> Create a new branch based on the last of commit of the current branch
git checkout <name> Switch from one branch to another
git checkout -b <name> Create a new branch and switch to it
git stash Temporarily move changed files out of the way
git stash apply Reapply changes that were stashed previously

How a merge works

Git syncing repositories

Command Description
git merge <branch> Merge commits from one branch into the other.
git merge --abort Abort a merge

How to resolve a merge conflict

Notes

Terms learned part 2