ï¼ãã®è¨äºã¯ããããã®è»¢è¼ã§ãï¼ èª²é¡ æ¥æ¬èªã®é·æãgitã§ç®¡çãã¦ããã¨ãã»ãã®ã¡ãã£ã¨ã®å¤æ´ã§ãdiffã§ã¯è¡ä¸¸ãã¨å¤æ´ããããã¨ã«ãªããå¤æ´ç¹ãããããããªããã¨ãããã äºæ³ä¸æ¥ã§å°èª¬ãæ¸ãéæ¿ãªã¤ãã³ãNovelJam 2018åå ä½åã§ããé«æ©æ樹æ°ã®ããªã¼ãããã£ã㯠ã¯ãªããã«ãã¯ãGitHubã使ã£ã¦å·çããã¦ãããå°èª¬ã§ã¯ãgit diffã®æ¬ ç¹ãã¯ã£ããã§ããé«æ©æ°ã¯åå ã¬ãã¼ãã§ãããæ¸ãã¦ããã ãã¨ãä»åå¾ãéè¦ãªç¥è¦ãªã®ã§ãããGithubã§ã¯ããç¨åº¦ä»¥ä¸ããã¹ããé·ããªã£ã¦ããã¨ãæ°æåã®èª¿æ´ã§å ¨é¨å·®åã¨ãã¦å¤å®ããããããã®ã§ãå°èª¬ã«ã¯åãã¦ãªãããªã¼ã¨æãã¾ãããå°èª¬ã¯è¡ã®ç§»åã¨ããããçºçããã®ã§ãGithubãããªãã¦Gitã¨ã®ç¸æ§ããããã¾ããã æ®éã«diffãåã 確ãã«ãæ®éã«diffãã¨ãã¨ãã®éããã³ãã³ãã©ã¤ã³ã§ããªã¼ãããã£ã㯠ã¯
è·å ´ã®Windows端æ«ã§Cygwinã§æä½ãã¦ããã¨ãã«ä»¥ä¸ã®ã³ãã³ããå®è¡ããã¨æååããã¦ãã¾ãã git diff . diffãæååãããã¨ä¿®æ£ããæ¥æ¬èªã®ã³ã¡ã³ãé¨åãèªããªãã£ãããããã¹ãã®ããã¥ã¡ã³ãã®å¤æ´ç¹ã追ããä¸ä¾¿ã 以ä¸ã®è¨å®ãè¡ããã¨ã§æååã対å¦ã§ããã git config --global core.pager 'lv -c' lvããã¼ã¸ã£ã¼ã«æå®ããã ãã ã¨æååã解決ã§ããªãã£ãã®ã§ -c ãªãã·ã§ã³ã追å ããã
ã¯ããã« git diff 㧠hunk ãèªåã追å åé¤ããã¨ããã«åºãªãã¦ã¤ã©ãã¨ãããã¨ã¯ããã¾ãããï¼ ããã解æ¶ããããã« git 2.9 㧠--compaction-heuristic ã¨ãããªãã·ã§ã³ãä½ããããé©å㪠hunk ã表示ãããã¨ãã試ã¿ããªããã¾ãããå½æã®ãªãªã¼ã¹ãã¼ã ããã¦git 2.11 ããããåãã®æå³éãã® hunk ã表示ããããã®ä»çµã¿ã¨ã㦠--indent-heuristic ã¨ãããªãã·ã§ã³ã追å ããã¾ãããGithubããã®ãªãªã¼ã¹è¨äº 追å ããæ¹æ³ git 2.11 ã§ã¯ãªãæ¹ã¯ã¾ãã¢ããã°ã¬ã¼ããã¦ãã ããã ã¨ãããã試ãã¦ã¿ããå ´å㯠git diff --indent-heuristic 常ã«æå¹ã«ãããå ´å㯠.gitconfig ã«ä»¥ä¸ã®ãªãã·ã§ã³ã追å ãã¾ãã
gitã§ããªãã¸ã§ã³ã®æ¯è¼ãã³ã³ããªã¯ãã®è§£æ¶ãmeldã§ããã«ã¯ã ãããã .gitconfigã«ä»¥ä¸ã追è¨ãã¦ããã¨ãgit difftool -dãgit mergetoolã§meldãèµ·åããããã«ãªãã [diff] tool = meld [difftool "meld"] cmd = meld $LOCAL $REMOTE [merge] tool = meld [mergetool "meld"] cmd = meld $LOCAL $BASE $REMOTE --auto-merge ã©ããããã¨ï¼ [difftool "meld"]ã«åºã¦ãã$LOCALã¨$REMOTEã¯ãããããå¤æ´åã¨å¤æ´å¾ã表ãã¦ããã1ã¤ç®ã®ãã©ã¡ã¼ã¿ãå·¦å´ã«è¡¨ç¤ºãããã [mergetool "meld"]ã®$LOCALã¨$REMOTEã¯ãããããæå ã®ãã¡ã¤ã«ã¨ãµã¼ãã®ãã¡ã¤ã«ã¨ãªãã $
ãã使ã Git ã³ãã³ãèªåç¨ã¡ã¢ã§ãã ãããã®ã³ãã³ãã®çµã¿åããã§ãªãã¨ãéçºã¯ã§ãã¦ãã¾ããæ°ããã³ãã³ããè¦ãããéæ追è¨ã ç®æ¬¡ åºæ¬æä½ ãã©ã³ãæä½ tag æä½ stash æä½ å¤æ´ãããç´ã rebase -i diff log ãªã¢ã¼ããã©ã³ããå ¨åé¤ããã¯ã³ã©ã¤ãã¼ ãªã¢ã¼ããã©ã³ããå ¨é¨ãã§ãã¯ã¢ã¦ãããã¯ã³ã©ã¤ãã¼ åºæ¬æä½ git init Git 管çãéå§ãããã«ã¬ã³ããã£ã¬ã¯ããªã« .git ãä½æãããã git add hoge.txt 対象ãã¹ãã¼ã¸ã³ã°ã¨ãªã¢ã«è¿½å ã git status ã¯ã¼ã¯ããªã¼ã¨ã¹ãã¼ã¸ã³ã°ã¨ãªã¢ã®ç¶æ³ã表示 git commit -m 'commit message' ã¹ãã¼ã¸ã³ã°ã¨ãªã¢ã®æ å ±ããªãã¸ããªã«åæ ã git rm hoge.txt 対象ãã¯ã¼ã¯ããªã¼ã¨ã¹ãã¼ã¸ã³ã°ã¨ãªã¢ããåé¤ã git mv hoge
Git Advent Calendar / Jun. 28æ¥ç®ã®è¨äºã§ãã27æ¥ç®ã¯ã¤ãã¯ãã§éå»ãçºæããã§ããã Git ãªãã¸ããªã®å¤ã§ git diff / git apply ãã¾ãç¥ããã¦ããªããã¨ã§ããã git diff 㨠git apply 㯠Git ãªãã¸ããªã®å¤ã§ã使ãã¾ããæ®éã® diff ã§ã¯ã§ããªãããã¤ããªãã¡ã¤ã«ãå«ã2ã¤ã®ãã£ã¬ã¯ããªã®å·®åãåãããã¨ããªã©ã«éå®ãã¾ããã¡ãã£ã¨è©¦ãã¦ã¿ã¾ãããã $ mkdir dir1 dir2 $ echo foo > dir1/text $ echo FOO > dir2/text $ dd if=/dev/random of=dir1/binary bs=128 count=1 $ dd if=/dev/random of=dir2/binary bs=128 count=1
å¹³ç´ ããQAï¼ ITããå©ç¨ããã ããèª ã«ãããã¨ããããã¾ãã QAï¼ ITã¯ã質åãåçããå ±æãããç·¨éããã¦ãããã¨ã§ãã¹ããªQAãèç©ã§ãããITã¨ã³ã¸ãã¢ã®ããã®åé¡è§£æ±ºã³ãã¥ããã£ã¼ãã¨ãã¦ç´7å¹´ééå¶ããã¦ãã¾ãããããã¾ã§ãµã¼ãã¹ãç¶ãããã¨ãã§ããã®ã¯ãQAï¼ ITã®ã³ã³ã»ããã«å ±æãããã ããé©åãªè³ªåãåçããå¯ãããã ããçãã¾ã®ãæ¯æ´ããã£ãããããã¨èãã¦ããã¾ããéãã¦å¾¡ç¤¼ç³ãä¸ãã¾ãã ããããªãããã¨ã³ã¸ãã¢ã®æ å ±å ¥ææ¹æ³ã®å¤æ§åãQAãµã¼ãã¹å¸å ´ã®ç¶æ³ãï¼ ITã®ä»å¾ã®ã¡ãã£ã¢éå¶æ¹éãªã©ãæ¤è¨ããçµæã2020å¹´2æ28æ¥ï¼éï¼15:00ããã¡ã¾ãã¦QAï¼ ITã®ãµã¼ãã¹ãçµäºãããã¨ã«ãã¾ããã ããã¾ã§ãå©ç¨ãããã ãã¾ããçãã¾ã«ã¯æ®å¿µãªãç¥ããã¨ãªããèª ã«å¿è¦ããæã£ã¦ããã¾ããä½ã¨ãããç解ãããã ãã¾ãã¨å¹¸ãã§ãã QAï¼ ITã®7å¹´éã§çãã¾ã®ç¥è
ãã¾ã¾ã§ãªãã¨ãªã使ã£ã¦ãããã©ããããã使ãæ¹ãåãã£ããããªæ°ãããã®ã§ã¡ã¢ã åæç¥è ã¤ã³ããã¯ã¹ã¨ã¯ã¼ãã³ã°ããªã¼ãç解ã§ãã¦ããã㨠HEAD ãä½ãåãã£ã¦ããã㨠git diff ã¯ã¼ãã³ã°ããªã¼ã¨ã¤ã³ããã¯ã¹ã®å·®åã表示ã git add ããå¾ã«ããã«ä¿®æ£ãããã©ãããããã°ã©ã®æç¹ã§ git add ããã®ããªã¼ãã¨ããã¨ãã«ä½¿ãï¼ git add ãããããã«ã³ãããããèªåã«ã¯é¢ä¿ãªãããã git diff --cached HEAD ã¨ã¤ã³ããã¯ã¹ã®å·®åã表示ã git add ãã¦ãã³ãããããåã«å·®åã確èªãããæã«ä½¿ããã ã¨æãã èªå㯠git diff ããããã£ã¡ã®æ¹ããã使ãã git diff HEAD HEAD ã¨ã¯ã¼ãã³ã°ããªã¼ã®å·®åã表示ã åã«ã³ãããããæããã©ããããç·¨éããã確èªãããæã«ä½¿ãã HEAD ã®é¨åã¯ã³ããã(HE
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}