Skip to content

Instantly share code, notes, and snippets.

@kazu69
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazu69/ab91d0bd5a4eb54716f1 to your computer and use it in GitHub Desktop.
Save kazu69/ab91d0bd5a4eb54716f1 to your computer and use it in GitHub Desktop.
git initial commit revert
# gitの参照は以下に存在している
tree -L 1 .git/refs
.git/refs
├── heads
├── remotes
├── stash
└── tags
# 例えば現在のmasterのhashは
cat .git/refs/heads/master
b3bd91d7995f2387a04a849e26a925ef88ea8063
# 参照を更新する
git update-ref -d HEAD
# これはだめでした > <
git reset --hard HEAD~1
git update-ref -h
usage: git update-ref [options] -d <refname> [<oldval>]
or: git update-ref [options] <refname> <newval> [<oldval>]
or: git update-ref [options] --stdin [-z]
-m <reason> reason of the update
-d delete the reference
--no-deref update <refname> not the one it points to
-z stdin has NUL-terminated arguments
--stdin read updates from stdin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment