Created
January 29, 2015 03:19
-
-
Save techieshark/529fac355740266f1dc2 to your computer and use it in GitHub Desktop.
Cleaning Mesa's downstream repo / syncing with CfA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is kind of long. It should be a lot simpler in the future, once these steps are done. | |
# Clone repo: | |
git clone https://github.com/CityOfMesaAZ/MuniciPal.git mesa-municipal | |
# get into repo | |
cd mesa-municipal | |
# Add the upstream repository: | |
git remote add upstream https://github.com/codeforamerica/MuniciPal.git | |
# Fetch the upstream branch from upstream repository: | |
git fetch upstream master | |
# Checkout a new branch (-b) that we'll call "upstream-master" based on the master branch in the upstream repository | |
git checkout -b upstream-master upstream/master | |
# Checkout a new branch (-b) that we'll call "master-copy" based on the local master branch | |
git checkout -b master-copy master | |
#Looking at the set of commits from https://github.com/CityOfMesaAZ/MuniciPal/commits/master, we can see that the last commit that is shared with the upstream branch is "7ec0b71 Merge pull request #131 from codeforamerica/fixes/130-continuous-reloading" so we can run an interactive (-i) rebase: | |
git rebase -i 7ec0b71 | |
#That drops us into a text editor and asks what we want to do with all the commits since then. | |
#We want these in a 'mesa-config' branch: | |
pick 97cb470 Update config.js | |
pick 0b5a893 Changed map.prj to Mesa MapBox account | |
pick ec0e481 Switched Google Analytics ID | |
#We want these on a 'mesa-customized' branch: | |
pick 59f6a2a Reverted to regular logo | |
pick 3b2bc59 Put [email protected] as the hello email | |
pick 52b1035 Update _footer.html.erb | |
#We'll ignore these (we can delete them): | |
pick 9518778 Switched to protocol agnostic links for css and js links in head. | |
pick a63868c Undo my changes to the css and js links. | |
pick 9de4744 Adding fb-root div to handle sporadic FB errors | |
pick 5d2e533 Added no cache meta tags (all browsers). | |
pick 86002a9 Removed no-cache meta tags | |
pick 39f42d5 Removed the fb-root div from the <body> | |
pick cc639e9 Create people.js | |
pick 3abbb0f Update people.js | |
pick 15d9c71 Update index.html.erb | |
pick 05c075e Update application.html.erb | |
pick 5ec56a6 Update index.html.erb | |
pick c035319 Update people.js | |
pick 65640ae Update people.js | |
pick 95b6fb9 Testing the adding of a file. | |
# Copy this branch to create a config branch | |
git checkout -b mesa-config | |
# And one for non-config customizations | |
git checkout -b mesa-customized | |
# Now let's make master-copy match the upstream master: | |
git checkout master-copy | |
git reset --hard 7ec0b71 (SHA from looking at GitX etc) | |
# Now use rebase to get rid of commits that should only be in the -customized branch | |
git checkout mesa-config | |
git rebase -i master-copy #delete some things | |
# Note that we need to add a commit to the mesa-config branch for switching the source of the council-info people.js | |
git checkout mesa-customized | |
edit index.html.erb (open sublime, search 'techieshark', jump to line, change to cityofmesaaz) | |
git status, add, commit | |
# Oops, we want that on the -config branch. Let's move this commit: | |
git checkout mesa-config | |
git log --oneline | |
git cherry-pick <sha-of-commit-changing-council-info-source> | |
# Now since the tip of the config branch changed, we want to rebase the customization branch on top of this. | |
git checkout mesa-customized | |
git rebase mesa-config | |
# Now we can do some merging. Make sure we're in the master-copy branch and we'll merge in changes from upstream: | |
git checkout master-copy | |
git merge upstream-master #and merge any conflicts | |
git checkout mesa-config | |
git rebase master-copy | |
git checkout mesa-customized | |
git rebase mesa-config | |
# Handle conflict | |
git add app/views/layouts/application.html.erb | |
git add app/views/layouts/_topbar.html.erb | |
git rebase --continue | |
# Thats it. Phew... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment