ååã®ã³ããããåãæ¶ãããã¨ãã«ã¯git update-refã使ã
gitã§ééãã¦æåã®ã³ãããããã¦ãã¾ã£ãå ´åã®è©±ãã³ãããã«å«ããããã¡ã¤ã«ã¨ããã¤ããã£ãã追å ãã¦ãã¾ã£ãå ´åã®å¯¾å¦æ³ã
ãã®å ´åãgit reset
ãªã©ã§æ»ããã¨ã¯ã§ããªããgit update-ref
ã使ããã
ãµã³ãã«
-> % cd /tmp/; mkdir sample-git; cd sample-git -> % git init Initialized empty Git repository in /private/tmp/sample-git/.git/ -> % git add -> % touch README -> % git status On branch master Initial commit Untracked files: (use "git add <file>..." to include in what will be committed) README nothing added to commit but untracked files present (use "git add" to track) -> % git add . -> % git commit -m 'first commit' [master (root-commit) 801a68b] first commit 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 README -> % git status On branch master nothing to commit, working directory clean
ãã®ã¨ãã®git log
ã¯ä»¥ä¸ã®ããã«ãªã£ã¦ããã
commit 801a68ba564098cb41f1dcaefec9fb3eb0ab7472 Author: Kenta Suzuki <[email protected]> Date: Fri Mar 28 09:57:29 2014 +0900 first commit
ããã§git update-ref
ããã
-> % git update-ref -d HEAD -> % git status On branch master Initial commit Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: README
ããã§ã³ãããåã®ç¶æ
ã«æ»ããã¨ãã§ããããã¡ããååã³ãããã®å ´å以å¤ã«ã使ããããæ®æ®µã¯git reset --soft HEAD^
ããã®ã§ããããã±ã¼ã¹ã§å°ããã¨ã¯ãã¾ããªãã¨æãã
ã¾ã¨ã
ååã³ããããããè½ã¡çãã¦æä½ãã¾ããããï¼åç