|# author: Thomas Aylott SubtleGradient.com|
|# author: Nathan Nobbe quickshiftin.com|
|# Find out where HEAD is pointing|
|head_ref=$(git show-ref --head -s | head -n 1)|
|# Check to see if transmit tag exists, and get transmit tag hash|
|_transmit_ref=$(git show-ref --verify -s refs/tags/transmit)|
|# If there's not transmit tag, create it for the first time.|
|if [ $? -gt 0 ]; then|
|# This won't work well for projects with multiple roots,|
|# but for the typical case it will find the first commit|
|# and tag that for the initial push.|
|first_commit=$(git rev-list --max-parents=0 HEAD)|
|echo 'Creating initial transmit tag'|
|git tag -m 'Creating transmit tag' transmit $first_commit|
|# Find out where the tag is pointing|
|# @note Probably a cleaner way to do this ...|
|transmit_ref=$(git cat-file tag $_transmit_ref | head -n 1 | sed 's/^object //')|
|# If the transmit tag is the same commit as HEAD,|
|# there's nothing to do|
|if [ "$transmit_ref" == "$head_ref" ]; then|
|echo 'No changes to push'|
|# Iterate over all the files that changed, adding then to Transmit|
|for i in $(git diff --name-only transmit HEAD); do|
|if [[ -e "$i" ]]; then|
|echo "Adding $i to Transmit"|
|open -a Transmit "$i"|
|# Update the tag so we know where the last push occurred|
|echo 'Updating transmit tag'|
|git tag -d transmit|
|git tag -m 'Updating transmit tag' transmit HEAD|
forgive my inexperience, but how would I implement this script?
I'm using BitBucket to track file changes, and transmit to upload them. I've configured DocSend so that I can drag-n-drop files onto the dock icon to upload.
If I understand this Gist correctly, it is for automating the uploading of only the changed files, right?
Since I'm using a Git client (BitBucket) to contribute to the repo, and I don't really understand how Git works fundamentally, is there a way to implement this Gist with BitBucket?
this is new territory for me, thanks for any help or explanation.
@adaptifyDesigns if you have configured DockSend then it should just work when you run the script. The key is this line in the if loop:
@adaptifyDesigns @saerts to install this script just copy the contents down to a file (ideally somewhere in your PATH env variable). In this example we'll call it "git-transmit". Make sure you are in the same directory that the code file that you pulled down is, then use the command:
Then simply run the script from the directory you set up in the DockSend.
Hi guys, for the motivation to this gist, please see this StackOverflow thread. Essentially, these are the commands you need to follow to install the script: