A series of Bash and ZShell scripts useful when teaching about git and GitHub
Перейти к файлу
Eric Hollenberry 4db094eeb8 Create file for ZPrezto
ZPrezto uses zhistory instead of zsh_history
2016-08-10 12:27:40 -07:00
script note deps and provide scrpit to install them 2016-01-13 15:43:29 -08:00
.gitignore note deps and provide scrpit to install them 2016-01-13 15:43:29 -08:00
Gemfile note deps and provide scrpit to install them 2016-01-13 15:43:29 -08:00
Gemfile.lock don't forget to record specific gem versions used 2016-01-13 15:57:47 -08:00
LICENSE.txt License > License.txt 2015-01-15 08:17:46 -06:00
README.md Minor spelling fix --> apps 2016-06-15 22:50:23 -04:00
Rakefile Add additional folders/files to excludes 2016-04-19 16:56:23 +02:00
add-collaborators Use more properful englishization hereabouts 2015-10-06 16:21:34 -05:00
common.rb Cleanup and move common code to common.rb 2015-08-12 17:16:43 -05:00
create-assigned-issue But actually work correctly 2015-08-25 19:03:04 -07:00
generaterandomchanges Renamed all scripts to have no filename extension 2011-11-27 14:21:36 -07:00
generaterandomfiles Renamed all scripts to have no filename extension 2011-11-27 14:21:36 -07:00
git-graphlive Simplify git-graphlive (defaults to 10 commits) 2015-01-15 08:37:17 -06:00
historytailbash Added history scripts 2012-08-29 22:20:00 -07:00
historytailzprezto Create file for ZPrezto 2016-08-10 12:27:40 -07:00
historytailzsh More flexibly trim off the history's entry number 2013-02-14 12:32:01 -05:00
transpose Rely heavily on Ruby's CSV for rendering CSVs 2016-06-13 21:41:22 -05:00
transpose-csv.rb Rely heavily on Ruby's CSV for rendering CSVs 2016-06-13 21:41:22 -05:00
treelive Improved treelive to accept parameters 2012-10-20 23:33:44 -06:00
welcome welcome should ask for name 2015-01-15 08:38:01 -06:00

README.md

Training::Utils

This is a package of git- and github-training scripts into an easily-installed package. This collection of utilities originated here.

Installation

If you have Ruby >= 1.9 installed, you can install these scripts into a directory in your $PATH by running:

$ script/bootstrap

Usage

generaterandomchanges <N> <base> <extension>

Generates N new commits, the content of each is a new file named "<base><I>.<extension>" with some random text.

$ generaterandomchanges 3 file txt
[master f377b54] A random change of 27129 to file1.txt
2 files changed, 7 insertions(+), 1 deletion(-)
create mode 100644 file1.txt
[master fd0965c] A random change of 15808 to file2.txt
1 file changed, 1 insertion(+)
create mode 100644 file2.txt
[master a704698] A random change of 26224 to file3.txt
1 file changed, 1 insertion(+)
create mode 100644 file3.txt

$ ls
README.md  file1.txt  file2.txt  file3.txt

$ git log --oneline
a704698 A random change of 26224 to file3.txt
fd0965c A random change of 15808 to file2.txt
f377b54 A random change of 27129 to file1.txt
ec9bce1 Add readme

generaterandomfiles <N> <base> <extension>

Generates N new files, each named "<base><I>.<extension>" with some random text.

$ generaterandomfiles 3 stuff txt

$ ls
README.md  stuff1.txt  stuff2.txt  stuff3.txt

$ git log --oneline
ec9bce1 Add readme

$ cat stuff1.txt
Some random text: 10660

git-graphlive <N optional, 10 default>

Perpetually loop git --no-pager log -<N> --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s' --abbrev-commit --date=relative. It's like "tail -f" for git log. It's sometimes useful to have this on a split screen, showing the git one-line, ASCII art git graph.

$ git graphlive 5
* 6cad0b4 - (HEAD, master) A random change of 19964 to file30.txt
* c9fd401 - A random change of 16742 to file29.txt
* d5794af - A random change of 22469 to file28.txt
* b2110a3 - A random change of 32088 to file27.txt
* 75d01a9 - A random change of 12572 to file26.txt

historytailbash and historytailzsh

Perpetually loop through history. It's like tail -f for history. Comes in bash and zsh flavors. It's sometimes useful to have this on a split screen, showing the recent history of commands.

transpose <file>.csv

Generate a transposed *.csv file from an input file.

treelive <depth>

Perpetually loop tree, up to depth folders deep in the hierarchy.

welcome <name>

Prints a welcome message:

-------------------------------------------------
Welcome to class on: Wed Jan 14 17:00:35 CST 2015
I'm Instructor Name Here, your instructor
-------------------------------------------------

Other Useful Apps

When training, we use lots of other apps. Here are some of our favorites:

Contributing

  1. Fork it ( https://github.com/githubtraining/training-utils/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request