Skip to content

Instantly share code, notes, and snippets.

@grdryn
Created December 5, 2016 23:35
Show Gist options
  • Save grdryn/958caef998c343a31b8a174cea48ae2c to your computer and use it in GitHub Desktop.
Save grdryn/958caef998c343a31b8a174cea48ae2c to your computer and use it in GitHub Desktop.
# Create a new branch from master & checkout
git co -b ungit master
# Make a new blob object
blob_sha1=$(echo "Let's ungit" | git hash-object -w --stdin)
# Add the blob as a file in the index
git update-index --add --cacheinfo 100644 ${blob_sha1} ungit.txt
# Make a tree object from the current index
tree_sha1=$(git write-tree)
# Make a commit object with the newly-created tree
commit_sha1=$(echo "Ungit all the things" | git commit-tree -p HEAD ${tree_sha1})
# Update the current branch with that new commit
git merge ${commit_sha1}
# WTF, where's my ungit.txt?!
ls && git status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment