Skip to content

Instantly share code, notes, and snippets.

@benolee
Forked from liluo/readme.md
Created April 14, 2013 02:01
Show Gist options
  • Save benolee/5381046 to your computer and use it in GitHub Desktop.
Save benolee/5381046 to your computer and use it in GitHub Desktop.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment