Skip to content

Instantly share code, notes, and snippets.

@liluo
Last active December 10, 2015 01:48
Show Gist options
  • Save liluo/4362426 to your computer and use it in GitHub Desktop.
Save liluo/4362426 to your computer and use it in GitHub Desktop.
Git Internals(for gist)

init

mkdir proj
cd proj
git init

config

git config user.name 'username'
git config user.email 'username@douban.com'

create

echo 'test' > first
git hash-object -w first # got a sha1 as s1
git update-index --add --cacheinfo 100644 s1 first
git write-tree # got a sha1 as s2
git commit-tree s2 -m " "# got a sha1 as s3
git -c core.logAllRefUpdates=True update-ref refs/heads/master s3

edit

echo 'test' > second
git hash-object -w first # got a sha1 as s1
git update-index --add --cacheinfo 100644 s1 second
git write-tree # got a sha1 as s2
git commit-tree s2 -p master -m " " # got a sha1 as s3
git -c core.logAllRefUpdates=True update-ref refs/heads/master s3
@alexband
Copy link

alexband commented Jan 9, 2013

test comment

@alexband
Copy link

alexband commented Jan 9, 2013

comment

@alexband
Copy link

alexband commented Jan 9, 2013

comemnt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment