ãgitå ¥é3ãgitã®ä½¿ãæ¹ ã³ãããã®æã¡æ¶ã(revert)
前回の続きã§ãã
ä»åã¯ã³ãããã®æã¡æ¶ãã«ã¤ãã¦ã§ãã
gitã®ä½¿ãæ¹ ã³ãããã®æã¡æ¶ã(revert)
â revert(æã¡æ¶ã)ã¨ã¯
ã³ãããã®æã¡æ¶ãããããã¨ã«ããã以åã®ã³ãããã«æ»ããã¨ãã§ãã¾ãã
ä»ã®ã¨ããFirst Commitã¨Second Commitãä½ã£ã¦ãã¦ãç¾å¨ã®ã³ãããä½ç½®ã¯Second Commitã«ããã¾ãã
æã¡æ¶ãã®å©ç¹ã¯ãFirst Commitã«æ»ã£ãæã«Second Commitã®æ
å ±ãæ¶ããªãç¹ã§ãã
ãFirst Commitä½æãâãSecond Commitä½æãã¨ããå±¥æ´ã
ãFirst Commitä½æãã¨ããå±¥æ´ã«å¤ããã®ã§ã¯ãªãã
ãFirst Commitä½æãâãSecond Commitä½æãâãSecond Commitä½æã®æã¡æ¶ããã¨ããå±¥æ´ã«å¤ããã¾ãã
Second Commitã¯å±¥æ´ã®ä¸ã«æ®ãç¶ããã®ã§ãå®å¿ãã¦æã¡æ¶ããããã¨ãã§ãã¾ãã
â¡revert(æã¡æ¶ã)ã®ä½¿ãæ¹
ããã§ã¯å®éã«revertã使ã£ã¦ã¿ã¾ãããã
$ git revert HEAD [detached HEAD cf45336] Revert "Second Commit" 1 file changed, 1 insertion(+), 2 deletions(-)
HEADã¯ä¸çªé ã®Commitãåãæ¶ãã¾ãã¨ãããã¨ã§ãã
ããã§ã¯git logã§ã³ãããã®ç¶æ
ã確èªãã¦ã¿ã¾ãã
$ git log commit cf453369abea76e3c4464a1639d7aac8b38f8c19 Author: åå <ã¡ã¼ã«ã¢ãã¬ã¹> Date: Mon Aug 17 16:51:17 2015 +0900 Revert "Second Commit" This reverts commit fa4595ff783ca02c8162e49ad3253a6734e67377. commit fa4595ff783ca02c8162e49ad3253a6734e67377 Author: åå <ã¡ã¼ã«ã¢ãã¬ã¹> Date: Mon Aug 17 16:18:13 2015 +0900 Second Commit commit 29afc77b42799082ca80138015bde8e7be0f6bda Author: åå <ã¡ã¼ã«ã¢ãã¬ã¹> Date: Mon Aug 17 16:10:01 2015 +0900 First Commit
revertã«ããSecond Commitãææ¶ããã
First Commit â Second Commit â Revert "Second Commit"
ã¨ããå±¥æ´ã«ãªãã¾ããã
Second Commitã¯æã¡æ¶ããã¾ããããå±¥æ´ã¨ãã¦æ®ã£ã¦ããã®ã§ãã¤ã§ãæ»ããã¨ãã§ãã¾ãï¼
ä»åã¯ããã¾ã§ã§ãã
ãããã¨ããããã¾ããã