Scenario
My background is helping teams improve and automate their development process. To that end, they usually have version control, but nothing else. That’s what we’re kicking off here.
Goals
We’re going to take the existing MiniTwit Flask example application and make two changes.
- Make the minitwit example folder top level in the repository.
- Remove the tests folder.
Now – I love tests. But people with a full suite of unit tests aren’t usually the ones who need automation and performance consulting.
Steps
- Let’s fork the flask repo on Github (not pictured).
Now, let’s clone our own repo locally.
↪ git clone git@github.com:csberg/flask.git Cloning into 'flask'... remote: Counting objects: 14842, done. remote: Compressing objects: 100% (28/28), done. remote: Total 14842 (delta 17), reused 23 (delta 11), pack-reused 14803 Receiving objects: 100% (14842/14842), 5.42 MiB | 471.00 KiB/s, done. Resolving deltas: 100% (10253/10253), done. Checking connectivity... done. ↪
Let’s smash down the repo and make “minitwit” the top level and working folder. I’ve used this several times when a tool has grown beyond the scope of living in a repository with other tools.
↪ git filter-branch --subdirectory-filter examples/minitwit/ -- master Rewrite 465922e5f1cb76cf669a38afe25facde2176b9f0 (34/41) (1 seconds passed, remaining 0 predicted) Ref 'refs/heads/master' was rewritten ↪ cd .. ↪ ls clients/ dockerfiles/ dotfiles@ flask/ websites/ ↪ mv flask/ minitwit/ ↪ ls clients/ dockerfiles/ dotfiles@ minitwit/ websites/ ↪ cd minitwit ↪ git push origin --force --all Counting objects: 158, done. Delta compression using up to 4 threads. Compressing objects: 100% (79/79), done. Writing objects: 100% (158/158), 31.30 KiB | 0 bytes/s, done. Total 158 (delta 72), reused 117 (delta 72) remote: Resolving deltas: 100% (72/72), done. To git@github.com:csberg/flask.git + 3a2f396...1036255 master -> master (forced update)
Now we can rename the repository (not pictured).
Remove the existing tests. Don’t worry, when we explore automation technologies later, we’ll add these back in.
↪ git rm -r tests rm 'tests/test_minitwit.py' ↪ git commit -m "Removed tests for scenario setup." [master 3518b97] Removed tests for scenario setup. 1 file changed, 149 deletions(-) delete mode 100644 tests/test_minitwit.py ↪
Background Reading
- How to tear apart a repository: the Git way, Atlassian.