Show Menu
Cheatography

ITS Web Team Git Cheats Cheat Sheet (DRAFT) by

A guide to Git for the ITS Web Team

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Develop

Git Work Started

To start any new work which is isolated in the code base
In your dev site
[If you are already in a branch and have uncomm­itted changes, then Git Your Save On first]
git checkout master
git fetch -p
git merge origin­/master
git checkout -b [usern­ame­]-[­new­-br­anc­h-d­esc­rip­tiv­e-name]

Git Your Save On

[Make sure you used Git Work Started first and are on your own branch!]
[In your dev site]
git add [files­/fo­lder]
git commit -m “Commit message. Best to make it descri­ptive and end in a period.”

Git Real

You're ready to take your changes to live
[Git Your Save On first!]
git checkout master
git fetch -p
git merge origin­/master
git merge [usern­ame­]-[­new­-br­anc­h-d­esc­rip­tiv­e-name]
[Fix any conflicts that may come up]
git push origin master
git branch -d [usern­ame­]-[­new­-br­anc­h-d­esc­rip­tiv­e-name]

Git Back to Old Work

If you have old work in a branch that you need to return to
[If you want to incorp­orate the latest commited changes]
git checkout master
git fetch -p
git merge origin­/master
git checkout [old-w­ork­-br­anch]
git merge master
[Fix any conflicts and start working]
------­---­---­---­---­---­---­---­-----
[If you want to get back to old work quickly and merge during save]
git checkout [old-w­ork­-br­anch]
[Make changes]
[Now Git Your Save On]
 

Testing

Git Test Tubing

[Head to Test Site]
git fetch -p
git checkout test
git merge origin­/master
[Test Away!]

Git Passed the Test

[Tests pass from Git Test Tubing]
git tag -am “Short descri­ption of what change is in tag.” live-Y­YYY­MMD­D-HHMM
git push origin live-Y­YYY­MMD­D-HHMM
 

Deploy

Git Stage Diving

[Create a tag via Git Passed the Test first!]
[Head to the stage site]
git fetch -p
git checkout stage
git reset --hard live-Y­YYY­MMD­D-HHMM

Git Busy Live'ing

[Create a tag via Git Passed the Test first!]
git fetch -p
git reset --hard live-Y­YYY­MMD­D-HHMM
[If deployment fails]
git tag
(List all tags)
git reset --hard live-Y­YYY­MMD­D-HHMM
(last known good tag)