Skip to content
pquackenbush edited this page Sep 5, 2015 · 6 revisions

Git - You need this. Any OS is supported (pretty much)

.gitignore
VERY IMPORTANT! The file in the root of a repository that tells git "Please do not commit 12 gigs of extraneous data I made while testing" and other similar things. Example, Docs

build.xml
Ant's instruction file, Jenkins (or another build service) looks here to figure out what it needs to do when building with ant. You probably won't need to edit this (for this class.) Example

Writing Things On Github That Look Fancy Read Me 1, Read Me 2

Important Git Commands Docs, Picture Guide

  • git clone https://github.com/rsanchez-wsu/fa15-ceg3120.git Clone a repo onto your machine.
  • git add MyFile.txt Tells git to begin tracking a file. If a file is not tracked it WILL NOT be committed.
  • git branch MyBranch Creates a new branch for the repo, branched from whichever commit your local repo is on.
  • git checkout MyBranch Changes your local repo to another branch. The default branch is master.
  • git push origin MyBranch Pushes any commits you have made locally to MyBranch to origin (the default target repo for pushes)
  • git config Sets certain variables. I suggest running git config --global user.name "My Name" and git config --global user.email johndoe@example.com
  • git stash Pushes your current dirty state (any uncommitted changes) onto a local stack. This is useful if you are working on multiple branches as it gives you a clean slate before fetching or pulling from another branch.
    • Some common arguments to stash: git stash apply, git stash list, git stash pop

Put these commands into git bash (comes with git) instead of the normal command line, if you want to ensure that they work.

Merging - READ ME I AM VERY IMPORTANT

When you are developing on a seperate branch from master you will eventually need to merge your work back into master. The easiest way to do this is:

  • git checkout master
  • git pull origin master
  • git merge MyBranch
  • git push origin master

If you have made changes to files that conflict with changes made by others between when you split off the branch and when you're trying to merge, git will prompt you for decisions regarding how to resolve those conflicts. Think very carefully and talk to other people about how you proceed. If you are developing ON master and are simply behind such that you need to merge, the easiest way to accomplish this is:

  • git merge origin/master
  • git push origin master

Bad merges and other commands can and do cause huge headaches for everyone involved. So be careful, 'kay? A Cautionary Tale