git dtã³ãã³ã - razokulover publog ãè¦ã¦èªåãgitã®ã³ãã³ããã«ã¹ã¿ãã¤ãºãã¦ãã®ãæãåºããã®ã§æ®æ®µãã使ã£ã¦ããã®ãç´¹ä»ãã¾ãã
対象è
ä½æ¥éä¸ã¯tmpã³ããããããããä½ã£ã¦ãæå¾ã« git rebase -i
ã§ã³ããããæ´ãã¦ãã人
åç½®ã
gitã®ã¿ã¤ãæ°ãæ¸ãã
gitã³ãã³ãã使ãæã«æ¯å git
ã¨3æåã¿ã¤ãããã®ã¯æéã®ç¡é§ãªã®ã§ã¨ã¤ãªã¢ã¹ã¤ããã®ããããããã¾ã
~/.bash_profile
ã¨ã ~/.bashrc
辺ãã«ä¸è¨ãæ¸ãã¾ãã
alias g='git'
ãã㧠g
ã ãã§gitã³ãã³ãã使ãã¾ã
git-now
- iwata/git-now
- tmp ã³ãããã®ããã®ç¬èªãµãã³ãã³ã git-now - ã¢ã¸ã£ã¤ã«SEãç®æãããã°
æéã§tmpã³ãããããããã®ã³ãã³ããMacãªã brew install git-now
ã§ok
~/.gitconfig
ã«ä¸è¨ãæ¸ãã¾ãã
[alias] n = now --all --stat
- --all :
git add .
ãã¦æ°è¦ãã¡ã¤ã«ãå ¨é¨ã³ããããã - --stat : ããã©ã«ãã ã¨ã³ãããã¡ãã»ã¼ã¸ã«diffãå ¨é¨å ¥ããããå¤æ´è¡æ°ã ãã«ãã
g n
ã ãã§ãã®ãããªtmpã³ããããåºæ¥ã¾ã
[from now] 2014/08/06 23:28:50 spec/helpers/application_helper_spec.rb | 4 ++++ 1 file changed, 4 insertions(+)
tig
ã¿ã¼ããã«ä¸ã§gitã®ã³ãããããªã¼ãããæãã«è¡¨ç¤ºãã¦ããã¾ãã
SourceTree ã便å©ãªãã§ãããã¿ã¼ããã«ããåããããªãæãç»é¢ããªããããªç°å¢ã§ã¯éå®ãã¾ãã
gitãéããæ¸ãããtigãªã®ã§è¦ããããã§ãã
tigãgitåæ§ä½¿ç¨åæ°ãå¤ãã®ã§ã¨ã¤ãªã¢ã¹ã«ãã¾ãã
alias t='tig' alias ta='tig --all'
ããã©ã«ãã ã¨ç¾å¨ã®branchããããªã¼ãè¦ããªãã§ããã--all
ãã¤ãããã¨ã§å
¨ã¦ã®branchãè¦ããã¨ãã§ãã¾ãã
ãæ¬é¡ãtigãã git rebase -i ãã
ã³ãããæ´å½¢ããæã¯
git rebase -i <ã³ãããID>
ã®ããã«ããã¨æãã¾ãããããããéå§ã³ããããæ¢ãã®ã¯å¤§å¤ãªã®ã§tigã§é¸æããã³ãããè¡ã git rebase -i
ã«æ¸¡ããããã«ãã¾ã
~/.tigrc
ã«ä¸è¨ãæ¸ãã¾ãã
bind main R !git rebase -i %(commit) bind diff R !git rebase -i %(commit)
.gitconfig
ã®aliasåæ§ ! ãã¤ããã¨ä»»æã®ã³ãã³ããå®è¡ã§ããã®ãå©ç¨ã㦠git rebase -i
ãå®è¡ãã¦ã¾ãã
%(commit)
ã«tigã§é¸æãã¦ããè¡ã®ã³ãããIDã渡ããã¾ãã
ä¸ã®è¨å®ã ã¨ã·ã§ã¼ãã«ãããã¼ãRã«ãã¦ãã¾ãã好ã¿ã«å¿ãã¦å¤ãã¦ãã ããã*1
ãããªã£ã
Rã§é¸æããè¡ãããä¸ãå
¨é¨ git rebase -i
ã§ç·¨é対象ã«ããå
¨é¨1ã¤ã®ã³ãããã«squashãã¦ã¾ãã
ãã³ã¡ã¨ã追è¨
git now --rebase ã¨ã¯ä½ãéãã®ã ããã¨æã£ã / git-nowã«éããã¾ã¨ãããæã«ä¾¿å©ã£ã¦ãã¨ã
ãã®éãã§ããä»åã¯tig㧠rebase -i
ããã®ãæ¬é¡ãªã®ã§ã大éã®commitãæ´å½¢ããã®ã説æããããããããã«git-nowãä¸ç·ã«ç´¹ä»ãã¾ãã
ã¿ã¼ããã«ã®gifç»åä½ãã®ã«ä½ã®ãã¼ã«ä½¿ã£ã¦ãã®ãç¥ãããããã¼å ¥åã®è¡¨ç¤ºãããã®ãé¢ç½ããï¼ããã¯å¤åãã¼ã¹ããã¼ã¯è¡¨ç¤ºã¢ããªã®KeyCastrã¨ãããªã¼ãã¼ã¬ã¤ãããªããã¹ã¯ãªã¼ã³ãã£ããã£ãã¦ãæãããªï¼
å¥ã®ã¨ã³ã㪠ã§è©³ããæ¸ãäºå®ã§ããLICEcapã¨KeyCastrã使ã£ã¦ã¾ã
tigãã git rebase -i ãããããããæã£ã - ããã«ã£ã http://t.co/Jvbs8QaxTu 俺ã ã£ãããã¾ãã¯git-nowã®fixupãã¦ããcommit --amendã§ã¡ãã»ã¼ã¸ä¿®æ£ããããªã¼
— ãµ''ããã (@bleis) 2014, 8æ 7
git-now --fixupã¯ãå
¬å¼ãã¨å¼ã°ãã¦ããgit-nowã«ã¯å«ã¾ãã¦ãªããã㪠http://t.co/SRxeeh2XQd
— ç½ãé«éãã (@masaru_b_cl) 2014, 8æ 7
以åfixupãªãã·ã§ã³ãé©å½ã«ä½ã£ã¦git-nowã«PRãããã¨ãããã ãã©ãããåãã£ã¦ãªãã¦ã´ããããããæ®ã£ãç¶æ
ã ã£ãã®ã§ãªã¸ã§ã¯ãããã
— ç½ãé«éãã (@masaru_b_cl) 2014, 8æ 7
ã¨ããããã§ã@mzp çgit-nowãè¯ã
— ç½ãé«éãã (@masaru_b_cl) 2014, 8æ 7
( ï¾Ð´ï¾)ï¾ï½¯!ï¼
*1:Rã¯rebase, revert, reset ãªã©ä½¿ç¨é »åº¦ã®é«ãã³ãã³ããå¤ãã®ã§ä½ãå²ãå½ã¦ããæ©ã¿ã©ãã