Skip to content
This repository has been archived by the owner on Jan 25, 2020. It is now read-only.
Scott Opell edited this page Aug 5, 2014 · 1 revision

Welcome to the hackathon wiki!

Local dev

Git Crash Course

(assumes some level of knowledge of git)

Determine your branch: git branch Your branch will be the one with the asterisk next to it.

Determine the current state of your working directory: ie, do you have changed files that haven't been committed

git status You'll see the following output if you're 'clean'

If you're not clean, it will list the files that are different.

use git diff to check what has changed in the files.

To get to a clean state, you can either discard the changes, or commit them. To discard, simply use git checkout -- <filename> In this example, I'd run the command git checkout -- index.html

To commit them, you first need to add them to the staging area.

git add index.html

then you take all the changes that you've "staged" and "commit" them. This is like creating a group of changes.

git commit -m "changes the title to signify which version is being used"

The text inside the quotes is a commit message. This tells other collaborators (or yourself a few months from now) what exactly you changed here. This is very useful for debugging.

To pull down changes

git pull will get new changes from the remote server and apply them to your current directory.

Switch branches

If you want to switch branches to one that you already have locally, then simply use this command.

git checkout branch_name where branch_name is the name of the branch.

If its a remote branch that you haven't worked on locally yet, then you can actually use the same command.

git checkout remote_branch_name This will create a branch on your local machine that tracks the remote branch by default.

You should always try to have a clean working directory before switching branches. There are cases when you don't need to, but you should always try to.

Pushing changes.

After you've made some commits and want to share them, you can push them to the remote branch of the same name by doing git push

Clone this wiki locally