• Stars
    star
    368
  • Rank 115,571 (Top 3 %)
  • Language
  • Created over 5 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A small git cheat sheet of common use-cases for my future self.

git Cheat Sheet

by Ben Nadel for future Ben Nadel

The git API is so vast and so esoteric, I can barely manage to keep a fraction of one-percent of it in my head. As such, I wanted to outline a few of the commands that I commonly (and sometimes uncommonly) reach for. This way, when I inevitably get stuck and my brain fails me, I have something that I can refer back to.

Future Ben, you are welcome!

Table of Contents

Use Cases

I want to show the status of the current branch.

The status command shows differences between the working tree, the index, and head commit.

git status

I want to create a new branch that is based on the current branch.

In general, you want to implement new features in short-lived "feature branches" so that changes can be isolated. You can use the checkout command to create a new branch based on the current branch:

git checkout master

# Creates a new branch, `my-feature`, based on `master`.
git checkout -b my-feature

I want to checkout the previous branch that I was on.

In some of the git commands, the - token refers to the "last branch" that you had checked-out. This makes it very easy to jump back-and-forth between two branches:

git checkout master
git checkout my-feature

# At this point, the `-` refers to the `master` branch.
git checkout -

# At this point, the `-` refers to the `my-feature` branch.
git checkout -

The - token can also be used to merge-in the last branch that you had checked-out:

git checkout my-feature
# ... changes to the working tree (your file system).
git add .
git commit -m "Awesome updates."
git checkout master

# At this point, the `-` refers to the `my-feature` branch.
git merge -

The - token can also be used to cherry-pick the most recent commit of the last branch that you had checked-out:

git checkout my-feature
# ... changes to the working tree (your file system).
git add .
git commit -m "Minor tweaks."

git checkout master

# At this point, the `-` refers to the `my-feature` branch.
git cherry-pick -

I want to list the files that have been modified in the current working tree.

By default, when you call git diff, you see all of the content that has been modified in the current working tree (and not yet staged). However, you can use the --stat modifier to simply list the files that have been modified:

git diff --stat

I want to view the changes that were made in a given commit.

When show is given a branch name, it will default to head - the last or most-recent commit on the given branch:

git checkout master

# Outputs the changes made to the `head` commit of the current (`master`)
# branch.
git show

# Outputs the changes made to the `head` commit of the `my-feature` branch.
git show my-feature

You can also use the show command to target a specific commit that is not the head commit. This can be done with a specific commit hash; or, a relative commit operator like ~:

# Outputs the changes made in the commit with the given hash.
git show 19e771

# Outputs the changes made in in a previous commit of the current (`master`)
# branch.
git show head~ # Show changes in first parent.
git show head~~ # Show changes in first parent's first parent.
git show head~~~ # Show changes in first parent's first parent's first parent.

# Outputs the changes made in a previous commit of the `my-feature` branch.
git show my-feature~
git show my-feature~~
git show my-feature~~~

I want to list the files that were changed in a given commit.

Just as with git diff, you can limit the output of the git show command using the --stat modifier. This will list the files that were changed in the given commit:

# Outputs the list of files changed in the commit with the given hash.
git show 19e771 --stat

I want to view the changes that were made across multiple commits.

While the show command can show you changes in a given commit, you can use the diff command to show changes across multiple commits:

git checkout master

# Outputs the changes between `head~` and `head` of the current branch. If
# only one commit is provided, other commit is assumed to be `head`.
git diff head~

# Outputs the changes between the first commit and the second commit.
git diff head~~~..head~~

And, since branch names are really just aliases for commits, you can use a branch name in order to show the changes between one branch and your branch:

git checkout my-feature

# At this point, the following are equivalent and output the changes between
# the `head` commit of the `master` branch and the `head` commit of the
# `my-feature` branch.
git diff master
git diff master..head
git diff master..my-feature

I want to view the changes that were made in a given file.

By default, the show command shows all of the changes in a given commit. You can limit the scope of the output by using the -- modifier and identifying a filepath:

# Outputs the changes made to the `README.md` file in the `head` commit of the
# `my-feature` branch.
git show my-feature -- README.md

# Outputs the changes made to the `README.md` file in the `19e771` commit.
git show 19e771 -- README.md

I want to view the contents of a file in a given commit.

By default, the show command shows you the changes made to a file in a given commit. However, if you want to view the entire contents of a file as defined at that time of a given commit, regardless of the changes made in that particular commit, you can use the : modifier to identify a filepath:

# Outputs the contents of the `README.md` file as defined in the `head` commit
# of the `my-feature` branch.
git show my-feature:README.md

# Outputs the contents of the `README.md` file as defined in the `19e771`
# commit.
git show 19e771:README.md

I want to open the contents of a file in a given commit in my editor.

Since you're working on the command-line, the output of any git-command can be piped into another command. As such, you can use the show command to open a previous commit's file-content in your editor or viewer of choice:

# Opens the `README.md` file from the `head` commit of the `my-feature` branch
# in the Sublime Text editor.
git show my-feature:README.md | subl

# Opens the `README.md` file from the `19e771` commit in the `less` viewer.
git show 19e771:README.md | less

I want to copy a file from a given commit into my current working tree.

Normally, the checkout command will update the entire working tree to point to a given commit. However, you can use the -- modifier to copy (or checkout) a single file from the given commit into your working tree:

git checkout my-feature

# While staying on the `my-feature` branch, copy the `README.md` file from
# the `master` branch into the current working tree. This will overwrite the
# current version of `README.md` in your working tree.
git checkout master -- README.md

I want to copy the last commit from another branch into my branch.

When you don't want to merge a branch into your current working tree, you can use the cherry-pick command to copy specific commit-changes into your working tree. Doing so creates a new commit on top of the current branch:

git checkout master

# Copy the `head` commit-changes of the `my-feature` branch onto the `master`
# branch. This will create a new `head` commit on `master`.
git cherry-pick my-feature

I want to copy an earlier commit from the current branch to the head.

Sometimes, after you understand why reverted code was breaking, you want to bring the reverted code back into play and then fix it. You could use the revert command in order to "revert the revert"; but, such terminology is unattractive. As such, you can cherry-pick the reverted commit to bring it back into the head where you can then fix it and commit it:

git checkout master

# Assuming that `head~~~` and `19e771` are the same commit, the following are
# equivalent and will copy the changes in `19e771` to the `head` of the 
# current branch (as a new commit).
git cherry-pick head~~~
git cherry-pick 19e771

I want to update the files in the current commit.

If you want to make changes to a commit after you've already committed the changes in your current working tree, you can use the --amend modifier. This will add any staged changes to the existing commit.

git commit -m "Woot, finally finished!"

# Oops, you forgot a change. Edit the file and stage it.
# ... changes to the working tree (your file system).
git add oops.txt

# Adds the currently-staged changes (oops.txt) to the current commit, giving
# you a chance to update the commit message.
git commit --amend

I want to edit the current commit message.

In addition to adding files to the current commit, the --amend modifier can also be used to change the current commit message:

git add .
git commit -m "This is greet."

# Oh noes! You misspelled "great". You can edit the current commit message:
git commit --amend -m "This is great."

Note that if you omit the -m message portion of this command, you will be able to edit the commit message in your configured editor.

I want to copy master into my feature branch.

At first, you may be tempted to simply merge your master branch into your feature branch, but doing so will create an unattactive, non-intuitive, Frankensteinian commit tree. Instead, you should rebase your feature branch on master. This will ensure that your feature commits are cleanly colocated in the commit tree and align more closely with a human mental model:

git checkout my-feature

# This will unwind the commits specific to the `my-feature` branch, pull in
# the missing `master` commits, and then replay your `my-feature` commits.
git rebase master

Once your my-feature branch has been rebased on master, you could then, if you wanted to, perform a --ff-only merge ("fast forward only") of your feature branch back into master:

git checkout my-feature
git rebase master

# Fast-forward merge of `my-feature` changes into `master`, which means there
# is no creation of a "merge commit" - your `my-features` changes are simply
# added to the top of `master`.
git checkout master
git merge --ff-only my-feature

That said, when you're working on a team where everyone uses a different git workflow, you will definitely want a "merge commit". This way, multi-commit merges can be easily reverted. To force a "merge commit", you can use the --no-ff modifier ("no fast forward"):

# Get the `my-feature` branch ready for merge.
git checkout my-feature
git rebase master

# Merge the `my-feature` branch into `master` creating a merge-commit.
git checkout master
git merge --no-ff my-feature

Now, if the merge needs to be reverted, you can simply revert the "merge commit" and all commits associated with the merge will be reverted.

I want to revert the merge of my feature branch into master.

If you performed a --ff-only merge of your feature branch into master, there's no "easy" solution. You either have to reset the branch to an earlier commit (rewriting history); or, you have to revert the individual commits in the merge.

If, however, you performed a --no-ff merge ("no fast forward") that created a "merge commit", all you have to do is revert the merge commit:

git checkout master

# Merge the feature branch in, creating a "merge commit".
git merge --no-ff my-feature

# On noes! You didn't mean to merge that in. Assuming that the "merge commit"
# is now the `head` of `master`, you can revert back to the commit's fist
# parent, the `master` branch: -m 1. And, since `head` and `master` are the
# same commit, the following are equivalent:
git revert -m 1 head
git revert -m 1 master

I want to extract changes that I accidentally made to master.

Sometimes, after you've finished working on your feature branch, you execute git checkout master, only find that you've been accidentally working on master the whole time (error: "Already on 'master'"). To fix this, you can checkout a new branch and reset your master branch:

git checkout master
# > error: Already on 'master'

# While on the `master` branch, create the `my-feature` branch as a copy of
# the `master` branch. This way, your `my-feature` branch will contain all of # your recent changes.
git checkout -b my-feature

# Now that your changes are safely isolated, get back into your `master`
# branch and `reset` it with the `--hard` modifier so that your local index
# and file system will match the remote copy.
git checkout master
git reset --hard origin/master

I want to undo the changes that I've made to my branch.

If you've edited some files and then change your mind about keeping those edits, you can reset the branch using the --hard modifier. This will update the working tree - your file structure - to match the structure of the last commit on the branch (head).

Caution: You will lose data when using the --hard option.

git checkout my-feature
# ... changes to the working tree (your file system).
git add .

# Remove the file from staging AND remove the changes from the file system.
git reset --hard

If you call git reset without the --hard option, it will reset the staging to match the head of the branch, but it will leave your file system in place. As such, you will be left with "unstaged changes" that can be modified and re-committed.

I want to remove unpublished changes from my branch.

If you've committed changes to the local copy of a remote (ie, published) branch, but you want to undo those changes, you can reset the local branch to match the remote branch:

git checkout my-feature

# Update the remote copy of the `my-feature` branch in order to make sure that
# you are working with the most up-to-date remote content.
git fetch origin my-feature

# Now, reset the local copy of `my-feature` to match the published copy. This
# will update your index and your local file system to match the published
# version of `my-feature`.
git reset --hard origin/my-feature

I want to see which branches have already been merged into master.

From any branch, you can locate the merged-in branches (that can be safely deleted) by using the --merged modifier:

git checkout master

# List all of the local branches that have been merged into `master`. This
# command will be relative to the branch that you have checked-out.
git branch --merged

I want to see which branches have not yet been merged into master.

From any branch, you can locate the unmerged branches by using the --no-merged modifier:

git checkout master

# List all of the local branches that have NOT YET been merged into `master`.
# This command will be relative the branch you have checked-out.
git branch --no-merged

I want to delete my feature branch.

After you're merged your feature branch into master, you can delete your feature branch using the branch command:

# Merge your `my-feature` branch into `master` creating a "merge commit."
git checkout master
git merge --no-ff my-feature

# Safely delete the merged-in `my-feature` branch. The `-d` modifier will
# error-out if the given branch has not yet been merged into the current
# branch.
git branch -d my-feature

If you want to abandon a feature branch, you can use the -D modifier to force-delete it even if it has not yet been merged into master:

git checkout master

# Force-delete the `my-feature` branch even though it has not been merged
# into the `master` branch.
git branch -D my-feature

I want to delete a remote branch.

When you delete a branch using git branch -d, it deletes your local copy; but, it doesn't delete the remote copy from your origin (ex, GitHub). To delete the remote copy, you have to push the branch using the : prefix:

git checkout master

# Safely delete the local copy of your `my-feature` branch. The `-d` modifier
# will error-out if the given branch has not been fully-merged into `master`.
git branch -d my-feature

# Delete the remote copy of the `my-feature` branch from the origin. The `:`
# prefix sends this through as a "delete" command for the given branch.
git push origin :my-feature

I want to update master because my push was rejected.

If you've committed changes to master but you forgot to pull recent changes from the remote master branch, your next push will be rejected with an error that looks like, "Updates were rejected because the tip of your current branch is behind its remote counterpart". To fix this, you can use the --rebase modifier:

git checkout master
git merge --no-ff my-feature

# Oh noes! You forgot to pull in the latest remote copy of `master` before you
# merged your `my-feature` commits. No problem, just `--rebase` your local
# `master` on the remote branch. This will move your local changes to the tip
# of the `master` branch.
git pull --rebase 

# Now that you've pulled-in the remote changes, you should be able to push
# your updated `master` branch.
git push origin master

I want to remove a file from my staging area.

If you accidentally added too many files to the staging area (in preparation for a git commit), you can use the rm --cached command to remove them from the staging area but keep them in the working tree:

git add .

# Oh noes! You didn't mean to add all of the files to the staging area. You
# can remove some of the staged files using the `--cached` modifier:
git rm --cached secrets.config

If you accidentally added an entire directory to the staging area, you can add the -r modifier to recursively apply the rm command:

git add .

# Oh noes! You didn't mean to add the ./config directory. You can recursively
# remove it with the `-r` modifier:
git rm --cached -r config/.

When you rm files using --cached, they will remain in your working tree and will become "unstaged" changes.

I want to squash several commits into one (or more) commits.

Your commit history is a representation or your personality. It is a manifestation of your self-respect and the respect you have for your team. As such, you will often need to rewrite your feature branch's history before merging it into master. This allows you to get rid of intermediary commit messages like, "still working on it." and "Meh, missed a bug.". To do this, you can perform an "interactive rebase".

The "interactive rebase" gives you an opportunity to indicate how intermediary commits should be rearranged. Some commits can be "squashed" (combined) together. Others can omitted (remove). And others can be edited. When performing an interactive rebase, you have to tell git which commit to use as the starting point. If you're on an up-to-date feature branch, the starting point should be master.

# Create the `my-feature` branch based on `master`.
git checkout master
git checkout -b my-feature

# ... changes to the working tree (your file system).
git add .
git commit -m "Getting close."

# ... changes to the working tree (your file system).
git add .
git commit -m "Missed a bug."

# ... changes to the working tree (your file system).
git add .
git commit -m "Uggggg! Why is this so hard?"

# ... changes to the working tree (your file system).
git add .
git commit -m "Woot, finally got this working."

# At this point, your commit history is sloppy and would bring much shame on
# your family if it ended-up in `master`. As such, you need to squash the
# commits down into a single commit using an interactive rebase. Here, you're
# telling `git` to use the `master` commit as the starting point:
git rebase -i master

As this point, git will open up an editor that outlines the various commits and asks you how you want to rearrange them. It should look something like this, with the commits listed in ascending order (oldest first):

pick 27fb3d2 Getting close.
pick e8214df Missed a bug.
pick ce5ed14 Uggggg! Why is this so hard?
pick f7ee6ab Woot, finally got this working.

# Rebase b0fced..f7ee6ab onto b0fced (4 commands)
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit

At this point, you can identify the later commits as needing to be squashed (s) down into the oldest commit (the one you are picking):

pick 27fb3d2 Getting close.
s e8214df Missed a bug.
s ce5ed14 Uggggg! Why is this so hard?
s f7ee6ab Woot, finally got this working.

Once saved, git will prompt you to provide a cleaner commit message. And, once provided, your four shameful commits will be squashed down into a single, cohesive, meaningful commit.

I want to squash several commits into one commit without using rebase.

In the vast majority of cases, if your git workflow is clean and true and your feature branch is short-lived, an interactive rebase should be straightforward and pain-free. However, once you make the mistake of periodically merging master into your feature branch, you are inviting a world of hurt. In such a case, you can use the merge command with the --squash modifier as an escape hatch.

When you run git merge --squash, you copy the file-changes from one branch into another branch without actually copying the commit meta-data. Instead, the changes are brought-over as staged changes on top of the current branch. At that point, you can commit all the staged changes as a single commit.

Assuming your my-feature branch needs to be "fixed", you can use the following workflow:

# Assuming that the `my-feature` branch is the branch that needs to be fixed,
# start off my renaming the branch as a backup (the `-m` modifier performs a
# rename):
git checkout my-feature
git branch -m my-feature-backup

# Now, checkout the `master` branch and use it to create a new, clean
# `my-feature` branch starting point.
git checkout master
git checkout -b my-feature

# At this point, your `my-feature` branch and your `master` branch should be
# identical. Now, you can "squash merge" your old feature branch into the new
# and clean `my-feature` branch:
git merge --squash my-feature-backup

# All the file-changes should now be in the `my-feature` branch as staged
# edits ready to be committed.
git commit -m "This feature is done and awesome."

# Delete the old backup branch as it is no longer needed. You will have to
# force delete (`-D`) it since it was never merged into `master`.
git branch -D my-feature-backup

ASIDE: You should almost never need to do this. If you find yourself having to do this a lot; or, you find yourself dealing with a lot of "conflict resolution", you need to reevaluate your git workflow. Chances are, your feature branches are living way too long.

I want to temporarily set-aside my feature work.

The life of a developer is typically "interrupt driven". As such, there is often a need to briefly set aside your current work in order to attend to more pressing matters. In such a case, it is tempting to use git stash and git stash pop to store pending changes. But, do not do this. Stashing code requires unnecessary mental overhead. Instead, simply commit the changes to your current feature branch and then perform an interactive rebase later on in order to clean up your commits:

# Oh noes! Something urgent just came up - commit your changes to your feature
# branch and then go attend to the more pressing work.
git add .
git commit -m "Saving current work - jumping to more urgent matters."

git checkout master

Now, you never have to remember where those pending changes are. This guarantees that you won't lose your work.

If you were working directly on master when urgent matters came up, you can still avoid having to use git stash. To keep your work, simply checkout a new branch and the commit your pending changes to that new branch:

# Oh noes! Something urgent just came up - checkout a new branch. This will
# move all of your current work (staged and unstaged) over to the new branch.
git checkout -b temp-work

# Commit any unstaged changes.
git add .
git commit -m "Saving current work - jumping to more urgent matters."

git checkout master

Now, your master branch should be back in a pristine state and your temp-work branch can be continued later.

I want to keep my changes during conflict resolution.

If your Git workflow is healthy - meaning that you have short-lived feature branches - conflicts should be very few and far between. In fact, I would assert that getting caught-up in frequent conflicts is an indication that something more fundamental to your workflow is primed for optimization.

That said, conflicts do happen. And, if you want to resolve a conflict by selecting "your version" of a file, you can use git checkout --theirs in a merge conflict, a cherry-pick conflict, and a rebase conflict.

In a merge conflict, --theirs indicates the branch being merged into the current context:

git checkout master
git merge --no-ff my-feature

# Oh noes! There is a conflict in "code.js". To keep your version of the
# code.js file, you can check-it-out using --theirs and the file path:
git checkout --theirs code.js
git add .
git merge --continue

Similarly, in a cherry-pick conflict, --theirs indicates the branch being cherry-picked into the current context:

git checkout master
git cherry-pick --no-ff my-feature

# Oh noes! There is a conflict in "code.js". To keep your version of the
# code.js file, you can check-it-out using --theirs and the file path:
git checkout --theirs code.js
git add .
git merge --continue

In a rebase conflict, --theirs indicates the branch that is being replayed on top of the current context (See Aside):

git checkout my-feature
git rebase master

# Oh noes! There is a conflict in "code.js". To keep your version of the
# code.js file, you can check-it-out using --theirs and the file path:
git checkout --theirs code.js
git add .
git rebase --continue

ASIDE: Using --theirs in a rebase can seem confusing because you are already in "your" feature branch. As such, it would seem logical that your version of the code would be targeted with --ours, not --theirs. However, a rebase operates kind of like a series of cherry-pick operations. You can think of a rebase as doing the following:

  • Check-out an earlier, common commit between your feature branch and the target branch.
  • Cherry-pick your feature branch commits onto the earlier commit.
  • Replace your feature branch with this temporary branch

With this mental model, "your" version - targeted using --theirs - is the version being cherry-picked into the "current context" (the temporary branch).

I want to find the commit that deleted a file.

To find a deleted file, you can use the git log command and filter the results based on file status and path patterns. In this case, you want to use --diff-filter=D which limits the results to deleted files. And, since the files in question have been deleted, the path pattern must come after the final -- delimiter:

# Find the commit that deleted the file "projects.js".
git log --diff-filter=D --name-only -- wwwroot/app/projects.js

The --name-only option includes statistics about the commit (which files were changed); but, limits the file meta-data to include file paths only.

Of course, since you are looking for a delete file, you may not remember the exact file path of the deleted file. In that case, you can use pattern matching on the file path:

# Find the commit that deleted the file "projects.js" that resided somewhere
# in the "app" directory. The double-asterisk matches across directories.
git log --diff-filter=D --name-only -- "wwwroot/app**/projects.js"

# You can even use pattern matching on the file name itself if you can't
# remember exactly what it was named.
git log --diff-filter=D --name-only -- "wwwroot/**/*project*.js"

The default output of the git log command can be a bit verbose since it outputs the commit message along with the deleted files. To minify the output, you can use the --oneline and --pretty options:

# Find the commit that deleted the file "projects.js", but only show a one-line
# commit message and the list of files.
git log --diff-filter=D --name-only --oneline -- "wwwroot/app**/projects.js"

# To get slightly easier-to-read output, you can use the `--pretty` option with
# some specialized formatting (instead of the `--oneline` option). This
# includes the abbreviated hash, the author, the relative date, and the
# subject line. And, includes some human-friendly line-breaks.
git log --diff-filter=D --name-only --pretty=format:"%Cgreen%h - %an, %ar : %s" -- "wwwroot/app**/projects.js"

I want to find the commit that deleted a file that contained a piece of code.

To find a deleted file that contained a given piece of code, you can use the git log command and filter based on pattern matching within the diff. In this case, you want to use --diff-filter=D which limits the results to deleted files.

You can use the -S option to match on a string literal:

# Find the commit that deleted a file that contained the code 'isProcessed'.
git log -S 'isProcessed' --diff-filter=D --name-only

# To limit the search to the "app" directory, you can include a file path after
# the final `--` delimiter.
git log -S 'isProcessed' --diff-filter=D --name-only -- wwwroot/app/

# To make the search case-insensitive, include the -i option.
git log -S 'isprocessed' -i --diff-filter=D --name-only

You can use the -G option to match on a Regular Expression pattern instead of a string literal:

# Find the commit that deleted a file that contained the code `isProcessed`,
# matching on strict word-boundaries.
git log -G '\bisProcessed\b' --diff-filter=D --name-only

# To make the search case-insensitive, include the `-i` option.
git log -G '\bisprocessed\b' -i --diff-filter=D --name-only

The default output of the git log command can be a bit verbose since it outputs the commit message along with the deleted files. To minify the output, you can use the --oneline and --pretty options:

# Find the commit that deleted a file that contained the code `isProcessed`,
# matching on strict word-boundaries.
git log -G '\bisProcessed\b' --diff-filter=D --name-only --oneline

# To get slightly easier-to-read output, you can use the `--pretty` option with
# some specialized formatting (instead of the `--oneline` option). This
# includes the abbreviated hash, the author, the relative date, and the
# subject line. And, includes some human-friendly line-breaks.
git log -G '\bisProcessed\b' --diff-filter=D --name-only --pretty=format:"%Cgreen%h - %an, %ar : %s"

Once you locate the commit that appears to contain your code, you can use the git show command to view the contents of the commit delta:

# Find the commit that deleted a file that contained the code `isProcessed`,
# matching on strict word-boundaries.
git log -G '\bisProcessed\b' --diff-filter=D --name-only --oneline

# The above `log` action listed commit `aef037`. Use `git show` to output the
# changes made in the given commit.
git show aef037

More Repositories

1

JavaScript-Demos

A collection of online demos created from blog posts.
HTML
760
star
2

AngularJS-Routing

An example of how to do deep routing in an AngularJS application when ngView is not enough.
JavaScript
226
star
3

AngularJS-Directive-Controllers

Exploring the use of directives Controllers to allow for inter-directive communication.
JavaScript
83
star
4

JSONWebTokens.cfc

Thi is a ColdFusion gateway to help encode and decode JSON web tokens.
ColdFusion
58
star
5

JsonSerializer.cfc

A JavaScript Object Notation (JSON) serialization utility for ColdFusion.
ColdFusion
47
star
6

httpi

httpi is an AngularJS module that provides a lightweight proxy for the $http service. It is intended to provide access to the flexible $http service while adding the value of the $resource module. But, in a way that's easier to use (cause $resource was too confusing for me).
JavaScript
40
star
7

POIUtility.cfc

A ColdFusion component (and set of custom tags) for reading and writing XLS (Excel) documents in ColdFusion.
ColdFusion
35
star
8

Node-Circuit-Breaker

A Node.js implementation of the Circuit Breaker pattern.
JavaScript
35
star
9

HashKeyCopier

I copy the $$hashKey from one object to another (based on object identifiers) in an attempt to cut down on the amount of DOM creation that AngularJS has to execute.
JavaScript
34
star
10

DeferredWithUpdate.js

This is an AngularJS class which augments the core $q class with update() and mistake() methods that provide callback hooks for deferred values that need to be resolved or rejected after the fact. This is intended to be used with cached responses.
JavaScript
34
star
11

Bookmarklet-Get-Watch-Count

I count the number of active $watch() bindings in the current AngularJS page.
JavaScript
30
star
12

CorMVC

An old attempt to build a jQuery and JavaScript powered client-side MVC framework.
JavaScript
27
star
13

Plupload-AngularJS

An exploration of using the Plupload file uploader inside of AngularJS.
JavaScript
25
star
14

Streamlined-Object-Modeling

I am currnently working through the book, Streamlined Object Modeling: Patterns, Rules, and Implementation. True object oriented programming (OOP) is a new world for me and it's really hard for me to wrap my head around. I'd like to get a nice set of code samples here that I can use to practice the modeling techniques outlined in the book.
Java
25
star
15

Object-Calisthenics

My attempt at performing the Object Calisthenics exercise as described by Jeff Bay.
JavaScript
22
star
16

MVC-Learning

I'm trying to learn more about MVC (Model-View-Controller) architecture in ColdFusion.
ColdFusion
19
star
17

Pusher.cfc

A ColdFusion wrapper for the Pusher.com REST API.
ColdFusion
18
star
18

Crypto.cfc

I provide easier access to Java's underlying crypto / security methods (before ColdFusion 10 introduced hmac() method).
ColdFusion
17
star
19

Best-Of-ColdFusion-10

For the Best of ColdFusion 10 project, I am trying to create a very simple app that takes HTML, extracts the CSS, and then inlines it for use within emails.
ColdFusion
15
star
20

CFHTTPSession.cfc

The CFHttpSession.cfc is a ColdFusion component that wraps around multiple CFHttp requests in such a way that cookie and session information is maintained from request to request. This allows you to use this ColdFusion component to log into remote systems and grab content that is behind a layer of security.
ColdFusion
15
star
21

ColdFusion.js-Deprecated

An experiment in porting ColdFusion application framework (Application.cfc) concepts into Node.js.
JavaScript
15
star
22

JSON-Explorer

TypeScript
14
star
23

Learning-Node.js

A collection of experiments that I am using to learn more about Node.js workflows and constructs - everything from Streams to Buffers to Promises.
JavaScript
14
star
24

TinyTest

A tiny unit testing framework built as a means to learn more about unit testing in ColdFusion.
ColdFusion
14
star
25

sequelize-comment

A Sequelize plugin that allows you to insert a SQL comment before the basic CRUD operations (SELECT, INSERT, UPDATE, DELETE) in order to facilitate easier debugging of slow queries.
JavaScript
12
star
26

Plupload-Demo

Plupload file upload demo.
JavaScript
11
star
27

ColdFusion-JRegEx

JRegEx is a ColdFusion wrapper around Java's Regular Expression pattern matching and replacing functionality.
ColdFusion
11
star
28

Incident-Commander

A small utility application for running Incidents (as the "Incident Commander") at InVision App, Inc.
TypeScript
11
star
29

Breadboarding-POC

Breadboarding POC in Angular 9 next.
TypeScript
10
star
30

JIRA-CSV-Formatter

A simple utility page that can take CSV data and / or files and generate the JIRA-flavored markup for generating HTML tables in comments.
HTML
10
star
31

TinyTestJS

Attempting to port the main concept of TinyTest over to a JavaScript runtime.
JavaScript
10
star
32

Plupload-Global-Uploader

An experiment in creating a global uploader that different upload contexts can "hook into" using various dropzones (ie, FileDrops). This is one using AngularJS.
JavaScript
9
star
33

StringUtils.cfc

A collection of String utility functions found in the Java Lib: org.apache.commons.lang.StringUtils - this is being reproduced as a "code kata" and means of relaxation and self-therapy.
ColdFusion
9
star
34

jQuery.fn.comments

A jQuery plugin that facilitates quering the DOM (Document Object Model) based on comment values and psuedo-attribute values.
JavaScript
8
star
35

AsyncTaskQueue.cfc

A ColdFusion component that allows a queue of low-priority tasks to be executed, in serial, in the context of a single CFThread. This way, your low-priority threads do not end up blocking your higher-priority threads.
ColdFusion
8
star
36

ColdFusion-10-WebSocket-AMD-Module

An attempt to encapsulate ColdFusion 10 WebSockets in an AMD-complient(ish) module so that they can be used with libraries like RequireJS.
JavaScript
8
star
37

ColdFusion-Rollout

A ColdFusion port of Rollout that facilitates the gradual rollout of features to your user-base using percentages, groups, and explicit user identifiers.
ColdFusion
8
star
38

ColdFusion-Hotwire-Demos

Exploring the use of Basecamp's Hotwire in a Lucee CFML context.
Dockerfile
7
star
39

Signature-Generator

Generating transparent PNGs of your name to be used as signature annotations in official documents.
JavaScript
7
star
40

Plupload-S3-Imgix

An exploration of using Plupload to upload files directly to Amazon S3 and then using Imgix for on-the-fly thumbnail creation using pre-signed S3 URLs as the origin for the web proxy.
ColdFusion
7
star
41

ModularJS-Education---DragDrop

A personal project for learning more about modular JavaScript application architecutre.
JavaScript
7
star
42

ColdFusion-Custom-Tag-Emails

This is a POC of using ColdFusion custom tags to layout emails.
ColdFusion
7
star
43

PubNub.cfc

A ColdFusion wrapper for the PubNub RESTful API
ColdFusion
7
star
44

PatternMatcher.cfc

The PatternMatcher.cfc provides access to the powerful, robust regular epxression engine in Java; but, abstracts the Java interactions behind an easy-to-use ColdFusion interface.
ColdFusion
7
star
45

CFRedlock

CFRedlock is a ColdFusion implementation of the Redlock distributed locking algorithm proposed by Redis.
ColdFusion
7
star
46

JSON-Linting

This application provides simple, secure, 100% client-side, network-free JSON linting that ensures that no one else is seeing the data you are testing. This is worry-free JSON linting.
HTML
7
star
47

Snooper.cfc

Snooper.cfc is a ColdFusion component for investigating live variable leaks in a production system.
ColdFusion
7
star
48

Fusion-Reactor-Alert

FusionReactorAlert.cfc is a ColdFusion component that parses Fusion Reactor alert emails into usable data structures. There is also a JavaScript and HTML example that provides a viewer online.
ColdFusion
7
star
49

Plupload-S3-Preview

An exploration in using Plupload to show a client-side preview of the selected images before uploading them to Amazon S3.
JavaScript
7
star
50

EmailYak.cfc

A ColdFusion wrapper for the Email Yak SMTP Proxy API.
ColdFusion
6
star
51

ColdFusion-Hotwire

An exploration of using Basecamp's Hotwire with ColdFusion (Lucee CFML).
ColdFusion
6
star
52

ColdFusion-Circuit-Breaker

A ColdFusion implementation of the Circuit Breaker pattern as popularized by Michael Nygard's book, Release It!
ColdFusion
6
star
53

poc-invision-screen-flow

Proof of Concept: InVision - Screen Flow
TypeScript
6
star
54

ColdFusion-ePub

A set of ColdFusion custom tags and components that allow for the generation of ePub electronic books.
ColdFusion
6
star
55

CUID-For-ColdFusion

This is a ColdFusion port of the cuid library which can be used to generate collision-resistant IDs that are optimized for horizontal scaling and performance.
ColdFusion
6
star
56

RegEx-Day-2014

Ben Nadel tries to create a fun pattern-matching game for Regular Expression Day 2014.
JavaScript
5
star
57

ResourceMapper.cfc

A ColdFusion component that can map resource URIs and HTTP methods to application event parameters.
ColdFusion
5
star
58

Plupload-Image-Preview

Use Plupload to show client-side image preview (before upload) using Base64-encoded data URLs.
JavaScript
5
star
59

Sticky-CDN

A super simple content delivery network (CDN) for my local development environment, built in ColdFusion.
ColdFusion
5
star
60

Plupload-S3-Demo

Trying to upload files directly from Plupload to Amazon S3 using ColdFusion.
JavaScript
5
star
61

StatsDGateway.cfc

This is a ColdFusion gateway to help send metrics to a statsD server (including extensions for DataDogHQ and DogStatsD).
ColdFusion
5
star
62

Kinky-Calendar

Kinky Calendar - Free ColdFusion Calendar System The Kinky Calendar System is a totally free ColdFusion calendar system that was designed, not as a stand-alone application, but rather as a module that could be easily integrated into an existing piece of ColdFusion software.
ColdFusion
5
star
63

Redis-Key-Scanner

A simple Redis Key Scanner using Lucee CFML and Jedis.
ColdFusion
4
star
64

big-sexy-poems-poc

This is a client-side only Proof-of-Concept (POC) for my BigSexy Poems application.
TypeScript
4
star
65

Strangler-Feature-Flags-Exploration

Just some noodling on creating and using feature flags in Lucee CFML / ColdFusion.
ColdFusion
4
star
66

RegEx-Day-2012

Regular Expression Day 2012 game to match regular expressions.
JavaScript
4
star
67

Password4j-in-Lucee-CFML

An exploration of the Password4j library in Lucee CFML.
ColdFusion
4
star
68

Gymspiration

My first Node.js project (and Github project, for that matter).
4
star
69

OWASP-Encoder.cfc

This is a light-weight ColdFusion wrapper for the OWASP Java Encode project that handles `javaCast()` invocation internally.
ColdFusion
4
star
70

AntiSamy-1.5.7-With-ColdFusion-10

I demonstrate how to use AntiSamy 1.5.7 with ColdFusion 10 and the help of the JavaLoader 1.2 component.
ColdFusion
4
star
71

Base32.cfc

A component that allows for Base32 encoding and decoding in ColdFusion.
ColdFusion
4
star
72

FeatureFlagsBookApp

A companion playground for my feature flags book.
ColdFusion
4
star
73

XDom.cfc

XDom.cfc is a ColdFusion component that facilitates the traversal, access, and mutation of ColdFusion XML documents (like jQuery does for the browser DOM).
ColdFusion
4
star
74

Plupload-Multiple-Dropzones

Looking at using multiple dropzones and file inputs with a single instance of the Plupload uploader.
JavaScript
3
star
75

DailyPrime.me

An experiment in learning more about Docker, containerization, and web server management.
JavaScript
3
star
76

ImgIXWebProxy.cfc

I provide a small ColdFusion wrapper to the ImgIX Web Proxy source which allows any publicly accessible URL to be routed through the ImgIX web processing API.
ColdFusion
3
star
77

Bookmarklets

Experimenting with some Bookmarklets that I can load into a browser.
JavaScript
3
star
78

AngularJS-XSRF

A quick look at AngularJS' Cross-Site Request Forgery (XSRF) features and how to use them in a ColdFusion application to help prevent XSRF / CSRF attacks.
ColdFusion
3
star
79

Plupload-Cluster

This a proof-of-concept of what it might look like to cluster Plupload instances in order to acheive parallel file uploads.
JavaScript
3
star
80

Plupload-S3-Chunk-Demo

A quick look at using Plupload to chunk uploads to Amazon S3 and then how to rebuild the master file using Amazon S3's multi-object upload feature.
JavaScript
3
star
81

ColdFusion-SQLite

An experiment in using Lucee CFML to connect to SQLite databases using JDBC.
ColdFusion
3
star
82

Plupload-Chunking-Demo

A quick look at using Plupload to chunk file uploads in a ColdFusion application. Chunking allows Plupload to break the target file up into multiple form posts which then must be reassembled on the server.
JavaScript
3
star
83

Git-Commit-Checklist

A simple AngularJS and Firebase application that takes a list of git commit log items and provides a way to coordinate the valiation and deployment of the commit list.
JavaScript
3
star
84

SpamAnalyzer.cfc

A ColdFusion component that works in conjunction with a collection of regular expression patterns to analyze user-provided content. Uses patterns to determine if user content should be considered Spam.
ColdFusion
3
star
85

CUID2-For-ColdFusion

A ColdFusion / CFML port of the Cuid2 library by Eric Elliott.
ColdFusion
2
star
86

bennadel.com-healthcheck

A Netlify powered healthcheck for my blog.
JavaScript
2
star
87

Flexmark-0.42.6-With-ColdFusion

Experimenting with the Flexmark Markdown library (v0.42.6) and ColdFusion.
ColdFusion
2
star
88

mvc-test-data.com

A simple Node.js server that serves up fake data while you learn client-side MVC architecture.
2
star
89

Plupload-S3-BeforeUpload

An exploration in using the "BeforeUpload" event handler in Plupload as a means to generate an Amazon S3 upload policy tailored specifically for the current file.
JavaScript
2
star
90

netlify-quick-share

Experiment with Netlify, Angular, and the in-built AWS Lambda functionality.
JavaScript
1
star
91

big-sexy-poems-www

Informational site for BigSexyPoems.
HTML
1
star
92

DatatypeConverter.cfc

I provide conversion methods for common data types in ColdFusion.
ColdFusion
1
star
93

Flexmark-0.32.24-With-ColdFusion

This demonstrates how to use the Flexdown 0.32.24 Java library with ColdFusion to parse markdown input into HTML output.
ColdFusion
1
star
94

Plupload-Data-URI-AngularJS

An exploration of how to consume Plupload data URIs, alongside remote image URLs, in the context of an AngularJS application.
JavaScript
1
star
95

ClosureCompiler.cfc

A ColdFusion component wrapper for interactions with (a subset of) Google's Closure compiler library.
ColdFusion
1
star
96

CSSRule.cfc

A ColdFusion component representation of a CSS rule.
ColdFusion
1
star
97

RegEx-Day-2017

This was an attempt to make an interactive "pattern search" for RegEx Day 2017. But, didn't quite get there.
TypeScript
1
star
98

ColdFusion-Datamuse

This is a thin ColdFusion wrapper around the Datamuse API.
ColdFusion
1
star
99

express-fw1

An experiment in porting fw/1 inspired ideas over to Express.js and Node.js.
JavaScript
1
star
100

Fun-Weekend-Challenge

Having fun with Node.js.
JavaScript
1
star