Helps you do your job
This page explains files in my git-utilities repo.
On a Mac:
Get the repo onto your machine using a Git UI or in a Git command line:
git clone https://github.com/wilsonmar/git-utilities
cd into the repo.
(If you don’t have it already) create a folder on the operating system’s path by copying the git-custom-commands folder from within the Git repository into a folder in your home directory.
Linux people often use /opt/bin, but on a Mac that is a protected area requiring sudo access.
create a folder under your $HOME folder and put that folder within the system path.
On a Mac, edit file ~/.bash_profile so the custom command files will be found when they are run on any folder.
PROTIP: git automatically make files available as a subcommand, just like regular executable scripts.
Exit terminal session windows or re-run the Terminal initialization:
cd into the git-custom-commands folder.
Set permissions to execute each file:
chmod 555 *
Try the git-echo command, created just so we can verify whether we have it working:
git echo "hello"
You should see response:
Instead of “hello”, you can type in any phrase.
A cross-platform Python can be executed.
Seth House did several videos on Git and GitHub, in which he showed use of a utility to create a visualization from the command line. He was nice enough to share it with me.
Install GraphViz using a package manager. On a Mac:
brew install graphviz
This installs dependencies libtiff, webp, gd
- http://www.graphviz.org/Download_macos.php - graphviz-2.40.1.pkg
Save the file from a text editor into folder
Alternately, copy the file graph-dag into that folder from the cloned folder.
Set permissions to execute the file:
chmod a+x graph-dag
Run the graph-dag that outputs a commit graph using the GraphViz “dot” tool:
git graph-dag HEAD~10.. | dot -Tpng > mygraph.png
Additionally, look at the other utilities at:
- Sorting commits by commit message line count / changed lines ratio
- Copying all changed files from the last N commits
- Setting the timestamps of the files to the commit timestamp of the commit which last touched them
Visualization of branches
git log does a good job of illustrating branches, but GitKraken provides this colorful branch graphics:
The master branch is the light-blue line on the left.
The Bug fix branch is the darker-blue line to the right of that.
The develop branch is the purple line to the right of that.
Make some ASCII art from (part of your) history
A - B - C \ \ D - E - F
This is one of a series on Git and GitHub:
- Why Git? (file-based backups vs Git clone)
- Git Markdown text
- Git basics (script)
- Git-client based workflows
- Git whoops (correct mistakes)
- Git rebase
- Git interactive merge (imerge)
- Git HEAD (Commitish references)
- Git custom commands
- Git utilities
- TFS vs GitHub
- GitHub REST API
- GitHub GraphQL API
- GitHub PowerShell API Programming
- GitHub GraphQL PowerShell Module