Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cool Stuff with Git

Cool Stuff with Git

Visual aid for the "Cool stuff with Git" hangout.
A few more basic things with git, with at twist of fun! *yay*

Florida Ivanne Elago

March 30, 2014
Tweet

More Decks by Florida Ivanne Elago

Other Decks in Programming

Transcript

  1. Requirements • Git installed on local machine • Text Editor:

    vim/emacs/nano etc… • Ruby • Homebrew for Mac [optional] ◦ install: ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
  2. Pretty outputs - git config Let’s edit our ~/.gitconfig file.

    We can modify our ~/.gitconfig file by running this command: git config --global color.ui auto this then becomes [color] ui = auto in the gitconfig file http://git.io/GhQ0CA
  3. Pretty outputs - colorize This is what happens when we

    set auto ui colors. florida@Floridas-MacBook-Pro ~/D/D/K/pretty_outputs > git diff diff --git a/cool b/cool index 8574c7e..f1964d9 100644 --- a/cool +++ b/cool @@ -1 +1 @@ -Hello.. worlds +Hello.. cool diff --git a/hello_world b/hello_world index 509e373..e2b39cc 100644 --- a/hello_world +++ b/hello_world @@ -1 +1 @@ -Hi ! Text ... stuff. +Hi ! Text ... things. florida@Floridas-MacBook-Pro ~/D/D/K/pretty_outputs > git status On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: cool modified: hello_world no changes added to commit (use "git add" and/or "git commit -a")
  4. Pretty outputs - oneliners online logs florida@Floridas-MacBook-Pro ~/D/D/K/pretty_outputs> git oneline

    4bfc835 (HEAD, master) add new stuff 5c53880 change words 72f323d add all files online diffs default diff: florida@Floridas-MacBook-Pro ~/D/D/K/pretty_outputs > git diff diff --git a/new_stuff b/new_stuff index d03940c..a9eb219 100644 --- a/new_stuff +++ b/new_stuff @@ -1 +1 @@ -I like new stuff. +I like new things and stuffs. oneline diff: florida@Floridas-MacBook-Pro ~/D/D/K/pretty_outputs > git wdiff diff --git a/new_stuff b/new_stuff index d03940c..a9eb219 100644 --- a/new_stuff +++ b/new_stuff @@ -1 +1 @@ I like new stuff.things and stuffs.
  5. Pretty outputs - awesome logs git lg1 * 532b652 -

    (29 minutes ago) fix merge conflict - Florida Elago (HEAD, add-new-idea) |\ | * 03a1f4a - (41 minutes ago) merge - Florida Elago (master) | |\ | | * 7ffbace - (42 minutes ago) cool names - Florida Elago (add-new-named | | * 7a30684 - (49 minutes ago) new named - Florida Elago | * | 15d7fc1 - (44 minutes ago) new cool line - Florida Elago | |/ * | d937e7d - (41 minutes ago) prepare for merge - Florida Elago * | 7d89561 - (43 minutes ago) add second line - Florida Elago |/ * 9eb0422 - (50 minutes ago) named - Florida Elago * 097e0b4 - (51 minutes ago) need to add cool things - Florida Elago * 30d051b - (53 minutes ago) add more things - Florida Elago (add-more-stuff) * 746f7e7 - (54 minutes ago) add cool stuff - Florida Elago * 5344814 - (4 hours ago) add new stuff - Florida Elago * 4bfc835 - (4 hours ago) add new stuff - Florida Elago * 5c53880 - (4 hours ago) change words - Florida Elago * 72f323d - (5 hours ago) add all files - Florida Elago
  6. Pretty outputs - awesome logs git lg2 * 532b652 -

    Sat, 29 Mar 2014 14:20:50 -0700 (44 minutes ago) (HEAD, add-new-idea) |\ fix merge conflict - Florida Elago | * 03a1f4a - Sat, 29 Mar 2014 14:08:36 -0700 (56 minutes ago) (master) | |\ merge - Florida Elago | | * 7ffbace - Sat, 29 Mar 2014 14:07:26 -0700 (58 minutes ago) (add-new-named) | | | cool names - Florida Elago | | * 7a30684 - Sat, 29 Mar 2014 14:00:34 -0700 (65 minutes ago) | | | new named - Florida Elago | * | 15d7fc1 - Sat, 29 Mar 2014 14:05:53 -0700 (59 minutes ago) | |/ new cool line - Florida Elago * | d937e7d - Sat, 29 Mar 2014 14:09:08 -0700 (56 minutes ago) | | prepare for merge - Florida Elago * | 7d89561 - Sat, 29 Mar 2014 14:06:40 -0700 (58 minutes ago) |/ add second line - Florida Elago * 9eb0422 - Sat, 29 Mar 2014 14:00:04 -0700 (65 minutes ago) | named - Florida Elago * 097e0b4 - Sat, 29 Mar 2014 13:58:27 -0700 (67 minutes ago) | need to add cool things - Florida Elago * 30d051b - Sat, 29 Mar 2014 13:56:28 -0700 (69 minutes ago) (add-more-stuff) | add more things - Florida Elago * 746f7e7 - Sat, 29 Mar 2014 13:55:42 -0700 (69 minutes ago) | add cool stuff - Florida Elago * 5344814 - Sat, 29 Mar 2014 10:51:03 -0700 (4 hours ago) | add new stuff - Florida Elago * 4bfc835 - Sat, 29 Mar 2014 10:47:51 -0700 (4 hours ago) | add new stuff - Florida Elago * 5c53880 - Sat, 29 Mar 2014 10:47:18 -0700 (4 hours ago) | change words - Florida Elago * 72f323d - Sat, 29 Mar 2014 09:57:15 -0700 (5 hours ago) add all files - Florida Elago
  7. Cool stuff - commit selfies Check the project out on

    Github: https://github.com/mroth/lolcommits Getting Started: # install dependencies # linux sudo apt-get install mplayer imagemagick libmagickwand-dev # mac brew install imagemagick # install gem gem install lolcommits
  8. Cool stuff - commit selfies Enabling lolcommits # cd to_directory_with_git

    $ lolcommits --enable # now let’s do a test commit $ touch test_file $ git add test_file $ git commit -m “testing lolcommits” *** Preserving this moment in history. [create-file-for-likes 0ca4f60] testing out 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 testing Yay we did it.
  9. Cool stuff - running in background Yay we made it

    work! But there’s an issue with it… lolcommits default settings doesn’t process in the backround. Let’s checkout all the options we can pass to lolcommits :) # let’s try running $ lolcommits --fork # test it out again $ touch new_test_file $ git new_test_file $ git commit -m “test fork”
  10. Cool stuff - gif animation (mac only) We can also

    capture gifs, but right now this feature is only available on mac. First we have to install the dependencies by running: brew install ffmpeg now we can pass the --animate=”numofseconds” to the command. Let’s try it out! lolcommits --enable --animate=4 --fork
  11. Cool stuff - github selfies github selfies is a browser

    extension that lets you add selfies to pull requests Checkout the project on Github: https://github.com/thieman/github-selfies Firefox Extension: http://goo.gl/YEgDLs Chrome Extension: http://goo.gl/AKNQ7X Let’s try it out!