git commit --fixup ã¨ãããªãã·ã§ã³ã®åå¨ãæè¿ç¥ã£ã¦èª¿ã¹ãã
ãã«ãã¨ãªãªã¼ã¹ãã¼ããã
"git commit" learned the --fixup and --squash options to help later invocation of interactive rebase. Git v1.7.4 Release Notes
--fixup=<commit>
Construct a commit message for use with rebase --autosquash. The commit message will be the subject line from the specified commit with a prefix of "fixup! ".
See git-rebase(1) for details.
1.7.4 ããå ¥ã£ã¦ããããã
ä½¿ãæ¹
ãµã¤ãã«ã³ãããããã¨ãã«ãå¥ã®æ¢åã®ã³ããããæå®ããã
git commit --fixup=HEAD~1
ããããå ´åã³ãããã¡ãã»ã¼ã¸ã¯ä¸è¦ã§ã代ããã«æå®ãããã³ãããã®ã³ãããã¡ãã»ã¼ã¸ã®å é ã« "fixup! " ãä»ä¸ãããã³ãããã¡ãã»ã¼ã¸ã使ç¨ãããã
% git log --oneline
e609512 fixup! some commit
9961eb5 meow
05aed73 some commit
147d264 init
ãªãã¨ãè²æ°ã®ãªãæ©è½ã§ãããã ãã ã¨ä½ã«ä½¿ããã®ãã¨æãããããã§ git-rebase ãç»å ´ããã
git rebase ã¨çµã¿åããã
git rebase ã«ã¤ãã¦è©³è¿°ã¯ããªãããããã¯éå»ã®ã³ããã群ã®è¦ªãã¤ãæ¿ãããªã©ãã¦æ´å²ãæ¹å¤ã§ããé«åº¦ãªã³ãã³ãã§ãã¨ãã« -i ãªãã·ã§ã³ã«ããã¤ã³ã¿ã©ã¯ãã£ãã¢ã¼ãã ã¨ã¨ãã£ã¿ãå©ç¨ãã¦è©³ç´°ãªç·¨éããããªãããããã§ã¯ "fixup" ã¨ããæç¤ºã使ãã¦ãæå®ããã³ãããã®å¤æ´ãã¾ãã£ã¨ãã®è¦ªã«å«ãã¦ãã¾ããã¨ãã§ãããããã³ããããããå¾ã«ããã®ã³ãããã«é¢ããã¡ãã£ã¨ããä¿®æ£ãå¾ç¥æµã§ã³ããããããã¨ãgit push åã« git rebase -iãã¨ããæµãã ãã¡ãªã¿ã« git commit --amend ã§ãåããããªãã¨ã¯ã§ãã¦ãã使ã£ã¦ããããããã¯ææ°ã®ã³ããããæ¸ãæãããã¨ããã§ããªãã
git commit --fixup ã¯ãã® git rebase -i ã¨ãã¾ãåãï¼ã¨ãããããã®ããã®ãã®ã§ããï¼ãgit rebase -i ã« --autosquash ãªãã·ã§ã³ãä¸ããã¨ãå
ã»ã©ã® "fixup! " ã§å§ã¾ãã³ããããèªåçã«æ¤åºãã¦ããã®ã³ããããä¿®æ£å
ã®ã³ãããã¨åä½ããã¦ãããããã«åé
ç½®ãã¦ãããã
å
ã»ã©ã®ä¾ã§ git rebase -i --autosquash HEAD~4 ãã¦ã¿ãã¨ãã¨ãã£ã¿ã«ã¯ä»¥ä¸ã®ãããªä¸¦ã³ãæç¤ºããã:
pick 05aed73 some commit
fixup e609512 fixup! some commit
pick 9961eb5 meow
ã³ãããã®é çªãä¸¦ã³æ¿ãã£ã¦ãã¦ããã®ã¾ã¾ã¨ãã£ã¿ãéããã° "fixup! some commit" ã®å¤æ´ã¯ "some commit" ã«åä½ãã¦æ´å²ããããã«æ¹å¤ãããã
ãã¾ã
Git ã®ã³ããã㯠:/<ã³ãããã¡ãã»ã¼ã¸ã®é¨åæåå> ã¨ããæå®ã®ä»æ¹ãã§ããã®ã§ãå
ã»ã©ã®ä¾ã ã¨
git commit --fixup HEAD~1
ã®ä»£ããã«
git commit --fixup ':/some commit'
ã®ãããªæå®ã®ä»æ¹ãã§ããã
2015-10-20 追è¨
git commit --fixup ã¨ã¯ä½ã - è©©ã¨åµä½ã»æç´¢ã®ã²ãã°commit --fixup ã¯ä¾¿å©ãããªãã ãã©ãæè¿ã¯ã³ãã³ãã©ã¤ã³ãã commit ããªããããªãâ¦ãmagit ã§ commit ããæã«æã§ãsquash!ãæ¸ãã¦ããmagit ã§ãã§ãããããªãautosquash 㯠.gitconfig ã«æ¸ãã¦ããã¨ä¾¿å©ã
2015/10/20 08:29
ãªãã»ã©ï¼ rebase.autosquash ã true ã«ãã¦ããã¨ãgit rebase -i æã«èªåã§ --autosquash ããããã§ããã
git config --global rebase.autosquash true

- ãã£ã¨èªã
ã³ã¡ã³ããæ¸ã