"Git reset"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-<source lang='cli'> +<source lang='console'>))
7번째 줄: 7번째 줄:
==실습==
==실습==
*사전작업: [[git commit]] 실습
*사전작업: [[git commit]] 실습
<source lang='cli'>
<source lang='console'>
root@zetawiki:~/workspace/hello# echo 'good morning' >> greet.txt
root@zetawiki:~/workspace/hello# echo 'good morning' >> greet.txt
root@zetawiki:~/workspace/hello# git add greet.txt  
root@zetawiki:~/workspace/hello# git add greet.txt  
14번째 줄: 14번째 줄:
  1 file changed, 1 insertion(+)
  1 file changed, 1 insertion(+)
</source>
</source>
<source lang='cli'>
<source lang='console'>
root@zetawiki:~/workspace/hello# git log
root@zetawiki:~/workspace/hello# git log
commit c88bffe4d7e3389a01704ef51390257ad38d0e95
commit c88bffe4d7e3389a01704ef51390257ad38d0e95
28번째 줄: 28번째 줄:
     hello world!
     hello world!
</source>
</source>
<source lang='cli'>
<source lang='console'>
root@zetawiki:~/workspace/hello# git reset 6b03476
root@zetawiki:~/workspace/hello# git reset 6b03476
Unstaged changes after reset:
Unstaged changes after reset:
M greet.txt
M greet.txt
</source>
</source>
<source lang='cli'>
<source lang='console'>
root@zetawiki:~/workspace/hello# git log
root@zetawiki:~/workspace/hello# git log
commit 6b0347639d7cb7a6a2f9d9c2eb239c66f152562a
commit 6b0347639d7cb7a6a2f9d9c2eb239c66f152562a
41번째 줄: 41번째 줄:
     hello world!
     hello world!
</source>
</source>
<source lang='cli'>
<source lang='console'>
root@zetawiki:~/workspace/hello# cat greet.txt
root@zetawiki:~/workspace/hello# cat greet.txt
hello world
hello world

2016년 3월 29일 (화) 10:30 판

1 개요

git reset
  • HEAD를 특정 commit 시점으로 되돌리는 git 명령어

 

2 실습

root@zetawiki:~/workspace/hello# echo 'good morning' >> greet.txt
root@zetawiki:~/workspace/hello# git add greet.txt 
root@zetawiki:~/workspace/hello# git commit -m 'good morning!'
[master c88bffe] good morning!
 1 file changed, 1 insertion(+)
root@zetawiki:~/workspace/hello# git log
commit c88bffe4d7e3389a01704ef51390257ad38d0e95
Author: gituser1 <gituser1@zetawiki.com>
Date:   Wed Mar 2 00:09:26 2016 +0900

    good morning!

commit 6b0347639d7cb7a6a2f9d9c2eb239c66f152562a
Author: gituser1 <gituser1@zetawiki.com>
Date:   Wed Mar 2 00:09:16 2016 +0900

    hello world!
root@zetawiki:~/workspace/hello# git reset 6b03476
Unstaged changes after reset:
M	greet.txt
root@zetawiki:~/workspace/hello# git log
commit 6b0347639d7cb7a6a2f9d9c2eb239c66f152562a
Author: gituser1 <gituser1@zetawiki.com>
Date:   Wed Mar 2 00:09:16 2016 +0900

    hello world!
root@zetawiki:~/workspace/hello# cat greet.txt
hello world
good morning
root@zetawiki:~/workspace/hello# git checkout greet.txt
root@zetawiki:~/workspace/hello# cat greet.txt
hello world

3 같이 보기

4 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}