Cheatography
https://cheatography.com
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.
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 uncommitted changes, then Git Your Save On first] |
git checkout master |
git fetch -p |
git merge origin/master |
git checkout -b [username]-[new-branch-descriptive-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/folder] |
git commit -m “Commit message. Best to make it descriptive 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 [username]-[new-branch-descriptive-name] |
[Fix any conflicts that may come up] |
git push origin master |
git branch -d [username]-[new-branch-descriptive-name] |
Git Back to Old Work
If you have old work in a branch that you need to return to |
[If you want to incorporate the latest commited changes] |
git checkout master |
git fetch -p |
git merge origin/master |
git checkout [old-work-branch] |
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-work-branch] |
[Make changes] |
[Now Git Your Save On] |
|
|
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 description of what change is in tag.” live-YYYYMMDD-HHMM |
git push origin live-YYYYMMDD-HHMM |
|
|
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-YYYYMMDD-HHMM |
Git Busy Live'ing
[Create a tag via Git Passed the Test first!] |
git fetch -p |
git reset --hard live-YYYYMMDD-HHMM |
[If deployment fails] |
git tag |
(List all tags) |
git reset --hard live-YYYYMMDD-HHMM |
(last known good tag) |
|