Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
ãgitã§ãã¹ã£ã¦masterã«commitãããããã«ãªã¢ã¼ãã¾ã§pushãã¡ãã£ãããªãã¦ã¨ãã®å¯¾å¦æ¹æ³ãresetãå¹ããªãããã©ã³ãæ»ãæä½ã¯ããããªãå ´åã«æå¹ãªãã®ãå®ä¾ã¨å ±ã«è¨è¼ãã¾ãã ããããä½æ¥é¢¨æ¯ ããããmasterã¨developã ãã®ã·ã³ãã«ãªæ§æãdevelopã§éçºãã¦ãã¾ãã ãã¾ã£ãããããã git commit developã«commitãããã£ãã®ã«ãééã£ã¦masterãã©ã³ãã«commitãã¦ãã¾ãã¾ãããããããã¨ããªã¢ã¼ãã«pushã¾ã§ãã¦ãã¾ãã¾ããããã£ãã¨ç´ããªãã¨éé£è½ã ã§ãã å¯¾å¦ : æé 1 git revert C4 ã¾ãã¯æ ã¦ãã«ãã¹ã£ã¦commitããå 容ãrevertãã¾ããããrevertã¯ã対象ã®ã³ããããæã¡æ¶ããããããä½ããªãã·ã§ã³ã§ãã ããã§åãæ¥ãã¯masterã«ééã£ã¦å ¥ã£ãcommitåãããã¾ãã
Git ã§ã³ãããï¼ã¨ããã¼ã¸ï¼ãç¡ãã£ããã¨ã«ããæ¹æ³ã¨ããã°ããgit revertããªã®ã§ããã使ãæ¹ã«ã¡ãã£ã¨ã²ã¨ã¯ã»ï¼ï¼ï¼ãã£ãã®ã§ã¡ã¢ã£ã¦ããã¾ãã ãgit revertãã¯æ£ç¢ºã«ã¯ãcommit ãç¡ãã£ããã¨ã«ããã®ã§ã¯ãªãã対象㮠commit ã®å¤æ´ãç¸æ®ºãããããªå·®åcommitãèªåã§çæããã¨ãããã®ã§ãã ã³ããããæåéãç¡ãã£ããã¨ã«ããï¼ã³ããããã°ããç¹å®ã®ã³ãããã ãæãåºãï¼å±¥æ´ãæ®ããªãããã«ããï¼ã«ã¯ããgit reset --hardããgit rebaseããgit cherry-pickããgit push -fããªã©ãé§ä½¿ããã°ã§ããã®ã§ãããããã¤ãã³ãããããã¼ã¸ãéããããå¾ã«ãããããã®ã¯ããã¾ãç¾å®çã¨ã¯è¨ãã¾ããããã ããã§ããgit revertãã®ç»å ´ã§ãã å®è·µ ä¾ãã°ã以ä¸ã®ãã㪠commit ããã£ãã¨ãã¾ãã
#!/bin/sh set -e # core.editorã«è¨å®ããããã® # merge,rebaseãªã©ã®æã«èµ·åãã CORE_EDITOR=vi # commitãããªãã£ãå ´å(mergeã¨ãrebaseã¨ã)ã®å ´åã¯CORE_EDITORã«æ¸¡ã if [[ ! "$1" = *COMMIT_EDITMSG ]]; then $CORE_EDITOR $1 exit 0 fi CURRENT_DIR=$(cd $(dirname $0); pwd) MSGLIST_FILE=$CURRENT_DIR/.gscme_msglist SAMPLE_MSGLIST_FILE=$CURRENT_DIR/sample_msglist/.gscme_msglist_present_tense_subject # .gscme_msglistãã¡ã¤ã«ãç¡ãå ´åã¯ä½ã # ããã©ã«ãã®è³ªåãªã¹
ããã«ã¡ã¯ã ä¹ ã ã®æ´æ°ã§ãã æè¿Schemaã¨ãããã¬ã¼ã ã¯ã¼ã¯ãä½ã£ã¦ããã PHPã§ã®éçºã«ã¤ãã¦è²ã ã¨æ°ããªç¥èãå¾ãæ©ä¼ãããããããã¾ãã ããã§ã¾ãã¯éçºç°å¢ã®æ§ç¯ç·¨ã¨ãã¦ãæä½éã®ãä½æ³ãæ ä¿ãã Gitã®hook ãä½æãã¦ã¿ã¾ããã ç®ç â 5ç®æ¡ ããããããã¡ãã¨ããã ã¨ãã話ã«å°½ããã®ã§ããã èªåã§ç¢ºèªãã¦ãããã«è¶ãããã¨ã¯ããã¾ããã ããã°ã©ãã¯å¾ã¦ãã¦æ©æ¢°çãªç¢ºèªãè¦æãªçãç©ã§ãã楽ãããã¨ã«å ¨åã§ããã¹ãã§ãã ï¼ãã¸ã¬ã¹ãããã¨ã人çè¦ç´ ãæé¤ãããã¨ã§ããã£ããã人çºçãªãã¹ãç¡ããªãã®ã§ããã確å®ã«ã³ã¼ãã®å質ãæ ä¿ã§ãã¾ãã ãã ãããã®ãã§ãã¯ãéãã°å®ç§ã¨ããããã§ã¯ãªãã®ã§ãå ãã¦åä½ç¢ºèªãã³ã¼ãã¬ãã¥ã¼çã®äººçãã§ãã¯ãå¿ è¦ãã¨æãã¾ãï¼ã ã¨è½æ¸ãã¯ãã®ãããã«ãã¦ããã¦ãå ·ä½çã«ãããããã¨ã¯ä»¥ä¸ã®éãã§ãã PHPã®æ§æã
9/18ï¼åï¼ 15ï¼30ï½ Gitã¨GitHubãä½é¨ããªãã身ã«ã¤ããåå¼·ä¼ï¼åå¤å±ï¼ : ATND è¡ã£ã¦ãã¾ããã ãªããããããã¨è©±ããã¨ã«ãªã£ããã§ããã©ããã®å ´ã§è¨ããã³ãããã¨ã¨ãããã£ã¨ãã説æãã¦ãã°ããã£ããªããã£ã¦é¨åã®è£è¶³ãå ¼ããã¨ã³ããªã§ãã é·æ注æã ã·ã§ã¼ãã«ãã git add ã®è©± git add -p/git reset -p ã®è©± ãªãã¸ã§ã³çªå·ããªã話 ãã©ã³ãã®è©± git-completion ã®è©±ã__git_ps1 ã®è©± ã³ãããã®æå®ã®è©± reset ã®è©± rebase 㨠merge ã®è©± å ¬éãããã®ã® rebase ã®è©± stash ã®è©± TortoiseGitãHGãSVNã®ã¯ãªã å ¨ä½ãéã㦠git add ã®è©± Git 㨠SVN ã§ã¯ãadd ã«éãããåãååã®ãµãã³ãã³ãã§ãæå³ãç°ãªããã®ãããã¤ãããã¾ãã ãã®ä¸
ããã¾ã Gitãªãã¸ããªã®ã¯ã¼ãã³ã°ããªã¼ã®ã«ã¼ããã£ã¬ã¯ããªããã«ã¬ã³ããã£ã¬ã¯ããªã¨ã®ç¸å¯¾ãã¹ãåå¾ã§ããã¨ããªãã¸ããªå ¨ä½ã«å¯¾ããå¦çã楽ã«ããã¦ä¾¿å©ã§ãã gitã«ã¯ãã®æ©è½ãåãã£ã¦ãã¾ãã®ã§ãããã使ã£ã¦ã¿ã¾ããã ããã¨ãã Git 1.9ã§ç¢ºèªãã¦ãã¾ãã ããã¥ã¢ã«è¦ãéãã§ã¯å¤§ä¸å¤«ããã§ãããã¡ãã£ã¨å¤ããã¼ã¸ã§ã³ã§ã¯åä½ããªããã¾ãã¯æåãç°ãªãå ´åãããã¾ãã æéã®ãªã人ç¨ã¾ã¨ã $ # Prepare $ pwd /home/myname $ git init foo-repo /home/myname/foo-repo/.git/ $ cd foo-repo/ $ mkdir -p bar/baz/ $ touch bar/baz/.gitkeep $ git add bar/baz/.gitkeep $ git commit -m "Initial com
ãã®è¨äºã¯ Git Advent Calendar 2016 ã® 20 æ¥ç®ã§ããgit ã³ãã³ããæ¥å¸¸çã«å®è¡ããããã§ãããå¤é¨ã¹ã¯ãªãããªã©ã§å人çã«æ¥ã æ¹åãã¦ããã話ã«ã¤ãã¦ã¾ã¨ãã¦ã¿ã¾ããã ãã©ã³ãåãæ¿ããææ©ããã git ãªãã¬ã¼ã·ã§ã³ã§ add,commit 並ã«å¤ç¨ããã¨æãã®ããã©ã³ãåãæ¿ãã§ãç¹ã« remote ã«ãã branch ã®åãæ¿ããªã©ãã·ã§ã¼ãã«ãããããã¹ã¯ãªãããæ¸ãã¾ããã $ git br 㧠fzf/peco ãªã©ã®ãã£ã«ã¿ã§åãæ¿ãã¦ããã¾ãããã©ã³ãåãæ¿ãç³»ã¯ãããã tips ãªã®ã§ãããä½ã便å©ãã¨ããã¨ãremotes/origin/HOGE ãªã©ã®ãªã¢ã¼ãã«ãããªããã©ã³ã㯠git checkout -b HOGE remote/origin/HOGE ãã¦ãããããã«ãªã£ã¦ããã®ã§æ°ã«ããã« checkout ã§ãã¾ã
Mislav MarohniÄããã® "A few git tips you didn't know about" ã翻訳ãã¾ããã å è¨äºã¯ãã¡ãï¼ http://mislav.uniqpath.com/2010/07/git-tips/ ï¼ç¿»è¨³ã®å ¬éã¯æ¬äººãã許諾æ¸ã¿ã§ãï¼ ç¿»è¨³ã®ééãçãããã°é æ ®ãªããææãã ããã ããªãã®ç¥ããªãGit Tips注æï¼ããã¤ãã®ã³ãã³ãããªãã·ã§ã³ã¯ Git ã® version 1.7.2 以éãå¿ è¦ã§ãã OS Xã§ã¯ã Homebrew ã§ç°¡åã«ã¢ããã°ã¬ã¼ãã§ãã¾ãï¼ brew install git git log ã§ãã©ã³ãã¨ã¿ã°ãè¦ã$ git log --oneline --decorate 7466000 (HEAD, mislav/master, mislav) fix test that fails if current d
Gitã¯ï¼ããã¼ã¸ã§ã³ç®¡çã·ã¹ãã (Version Control System)ã ã¨å¼ã°ããã½ããã¦ã§ã¢ã®ä¸ç¨®ã§ï¼å種ã®ãã®ã¨ãã¦ã¯ï¼ CVS, Subversion, Mercurialãªã©ãããï¼ è¦ããã«è¤æ°ã®äººéã§ï¼ã½ã¼ã¹ã³ã¼ãã«é¢ããå¤æ´ãå®å ¨ã«è¡ãã·ã¹ãã ã§ããï¼ è¤æ°ã®äººéã§åãã½ããã¦ã§ã¢ããããã¨ãã«ï¼ å¤æ´ç¹ãä»ã®äººã«ä¼ããã®ã«ã¾ããæ¯åæåã§ã¡ã¼ã«ãããã¨ãï¼ ã¨ããããã«ãè¡ããªãï¼ ãã¨ãã£ã¦ï¼æ¬å½ã«åããã¡ã¤ã«ãè¤æ°äººãåæã«æ´æ°ãããï¼ ã¿ã¤ãã³ã°æ¬¡ç¬¬ã§ãäºãã®æ´æ°ããäºãã«ã¤ã¶ããããããªäºæ ãï¼ å®¹æã«çºçãã¦ãã¾ãï¼ æå ã§ããç¨åº¦ã¾ã¨ã¾ã£ãæ´æ°ãè¡ãï¼ æä½ã§ãã³ã³ãã¤ã«ãéãç¨åº¦ã¾ã§ã¾ã¨ã¾ã£ãã¨ããã§ï¼ å¤æ´ç¹ãä¸æ¬ãã¦ä»ã®äººã«ä¼ããï¼ ã¨ããã®ããããã®ã·ã¹ãã ã®ä¸»ãªç®çã§ããï¼ ãã®ãã¼ã¸ã§ã¯ï¼Gitï¼ã¨GitLabï¼ã®åºæ¬çãªä½¿ãæ¹ã¨ãã¦
ç§ã¯ã³ããããã°ã®æ¸ãæ¹ã«æ©ãè±èªã®è¦æãªäººéã§ãããå®éãä¼¼ããããªäººã¯ä¸ã®ä¸ã«çµæ§ããããã§ãé »åºåèªãéè¨ãããã¾ã¨ãããã®ã¯æ¢ã«ãã£ã¦å½¹ã«ç«ã¤ã®ã ããã©ããããã¯ããã¾ã§åèªã®è©±ã§ãããå ·ä½çãªæãæ§æããéç¨ã§ãã£ã±ãå°ãé¨åãããªããã£ãã è¦ããã«ãã©ãããæã«ã©ãããæã使ããã¦ããã®ããã¨ãããã¨ã示ããä¾æéã欲ããã®ã§ãããã°ã°ãã¨ä»ã«ããä¾æéãããã°ããã®ã«ãã¿ãããªå£°ã¯ãããããã¦ãããã誰ãä½ããã¨ããªããä½ãªãã ãåããããããç§ã楽ã§ããªããããªããã ä»æ¹ãªãèªåã§ã¾ã¨ããã®ã§ãå¢ç°ã«åãæµãã¦ããã ã¯ããã«ããã§æãã¦ããã³ããããã°ã¯å ¨ã¦å®éã®ã³ããããã°ããã®è»¢è¼ã§ãããå½ç¶ãªããåã³ããããã°ã®èä½æ¨©ã¯ããããã®æ¸ãæã«ãããããããåè±æã§ã°ã°ãã°åºã¦ãããããã§ã¢ã¦ã¼ã¹ã®ç¯å²ãªã許ãã¦ãããã ããã¨èãååã¨ããã¸ã§ã¯ãåã¯å²æãããããã
ä»æ¥ã¯ãGit ã§è¤æ°äººä½æ¥ãè¡ãéã«å ±æãªãã¸ããªãã pull ããéã® rebase ãªãã·ã§ã³ã®å¿ è¦æ§ã«ã¤ãã¦æ¤è¨ãã¦ã¿ã¾ããã ã¿ã¤ãã«ã§çµæã¯æ³åã¤ããããªæ°ããã¾ãããé ã追ã£ã¦ã¿ã¾ãããã git pull ã§ãã£ã¦ãã㨠merge 㨠rebase git pull 㨠git pull --rebase ã¾ã¨ã 1. git pull ã§ãã£ã¦ãã㨠git pull ã³ãã³ãã¯ãfetch, merge ãã¾ã¨ãã¦å®è¡ãã¦ãã¾ãã ã¤ã¾ãããªã¢ã¼ããã©ã³ãã®ææ°ã®ã³ãããæ å ±ããã¼ã«ã«ãã©ããã³ã°ãã©ã³ãã¸æã£ã¦ãã¦ï¼fetchï¼ãæã£ã¦ããææ°ã®ã³ãããæ å ±ã¨ãã¼ã«ã«ãã©ã³ãããã¼ã¸ï¼mergeï¼ãã¾ãã åèï¼3.5 Git ã®ãã©ã³ãæ©è½ - ãªã¢ã¼ããã©ã³ã 2. merge 㨠rebase ãã©ã³ããçµ±åããã«ã¯ããã¼ã¸ã®ä»ã«ãªãã¼ã¹ãããã¾ãã mer
â»ãã®è¨äºã¯å ã ãGitã®ããããã¦ï¼ãªã¹ããã¨ãã¦2015å¹´11æã«æ稿ãããã®ãæ¹è¨ãããã®ã§ãã ãã®è¨äºã«ã¤ã㦠ç§ãå人çã«gitã¨ãã«ãªã¯ã¨ã¹ãã«ã¤ãã¦ãããããã¦æ¬²ãããã¨ããããã¯ãããªãã§ï¼ï¼ãã¨ãæã£ã¦ãããã¨ãã¾ã¨ãããã®ã§ãã å ã ã¯2015å¹´ã«ç§ãã³ã¼ãã¬ãã¥ã¼ããã¦ãæã«æ°ã«ãªã£ããã¨ãããã¾ãæ¨æ²ãããæããã¾ã¾ã«æ¸ããè¨äºã§ãããä»æ¹ãã¦èªã¿è¿ãã¨ç¨æãªæç« ãªã®ã¨ãä»ã«æãã¨ããã¨ããã£ããããã®ã§ãæ¹ãã¦æ¸ãç´ãã¾ããããããè²°ã£ã¦ãã®ã«æ¸ãç´ãã®ã«è¥å¹²å¾ãããããããã®ã§ãããããããå 容ã«ã§ããã°ã¨æãã¾ãã ã³ããããã°ããããã ã¨ã¬ãã¥ã¼ãããã ä¸äººã§éçºããã¨ãã¯git使ã£ã¦ã¦ããã©ã³ãåããªããããã«ãªã¯ãã ããªããã§ãã³ããããã°ã"First Commit"ã®æ¬¡ã"Second Commit"ã¨ãã§ãæ¯éã¯ãªãã§ãããããããã¼ã ã§éçºã
ã¯ããã« ããã«ã¡ã¯ãã¯ã¬ã¤ã®äºäºã§ããããæè¿ä¸æ°ã«æ°æ¸©ãä¸ããã¾ããããé¡ã«éç¹çã«æ±ãããã¿ã¤ãã®ç§ã«ã¯æ鬱ãªå£ç¯ããã£ã¦ã¾ããã¾ãã ãã¦ãä»ææ£å¼ãªãªã¼ã¹ãã¾ãã(ï¼) DocBase ããã¸ã§ã¯ãã§ã¯ã¯ã¬ã¤å¤é¨ã®ãã¶ã¤ãã¼ã®æ¹ã¨ä¸ç·ã«éçºãã¦ãã¾ããSourceTree 㧠Git ã使ã£ã¦ããæ¹ã§ã軽ããã¶ã¤ã³ä¿®æ£ãªã©ã¯å¼ç¤¾ã® Rails ããã¸ã§ã¯ãã«ç´æ¥æãå ãã¦ãã«ãªã¯ã¨ã¹ããéã£ã¦ããã¾ãã ãã¡ãã®ãã¶ã¤ãã¼ããã«ããã«ãªã¯ã¨ã¹ããéãéã¯ãä½æ¥ãã©ã³ã㧠git pull --rebase origin master ãã¦ããéã£ã¦ãããã¾ããï¼ãã¨ãé¡ãããã¨ãpull ã¯ããããã§ããã©ããã® --rebase ã£ã¦ãªãã§ããï¼ããã¤ããã¨ä½ãå¤ãããã§ããï¼ãã¨è³ªåãããã®ã§ãã ä½æ¥ãã©ã³ã㧠git pull --rebase origin master
ç®æ¬¡ ãµã¼ãã¼ã«gitã¬ãã¸ããªãä½æ ãã¼ã«ã«ã«ãµã¼ãã¼ä¸ã®gitã¬ãã¸ããªãç»é²ãã ãã¼ã«ã«ã®å 容ããµã¼ãã¼ã®ãªãã¸ããªã¸pushãã masterãpush master以å¤ã®ãã©ã³ããpush ã¯ãã¼ã³ãã master以å¤ã®ãã©ã³ããã¯ãã¼ã³ãã submoduleãããå ´å ã¬ãã¸ããªã®æ´æ° ã¬ãã¸ããªãå¥ãµã¼ãã¼ã«ç§»ã 移ãããå ã®ãµã¼ãã¼ã§æºå gitã¬ãã¸ããªã®ç»é²å ãå¤æ´ãã pushãã ã¾ãå¥ã®ãã·ã³ã§ã¬ãã¸ããªã®ç»é²å ãå¤æ´ ãµã¼ãã¼ã«gitã¬ãã¸ããªãä½æ test.git ã¨ãããã£ã¬ã¯ããªã¨ãã $ mkdir test.git $ cd test.git $ git init --bare ãã¼ã«ã«ã«ãµã¼ãã¼ä¸ã®gitã¬ãã¸ããªãç»é²ãã ãã¼ã«ã«ã®git管çãã¦ãããã£ã¬ã¯ããªã§ãä¸ã§ä½ã£ããµã¼ãã¼ã®ã¬ãã¸ããªãremote addãããååã¯orig
gitã使ãå§ããã¨commit, push, pullãªã©ã¯ããç¨åº¦ç解åºæ¥ãããã«ãªãã¾ãããfetchã£ã¦ãªãã ï¼ã£ã¦ãªãã¾ãããã ãã¾ã馴æã¿ã«ããã®ã¯ãpullãfetchã¨mergeã®ä¸¡æ¹ãçµã¿åãããã³ãã³ãã ãããªãã§ããã fetchã¨ã¯ gitã®å ´åããªãã¸ããªã¯ãªã¢ã¼ãã¨ãã¼ã«ã«ã®ï¼ã¶æããã¾ããfetchã¨ã¯ãªã¢ã¼ããªãã¸ããªããææ°æ å ±ããã¼ã«ã«ãªãã¸ããªã«æã£ã¦ããã³ãã³ãã§ãã fetchããã¦ããpullã®ããã«ãã¡ã¤ã«ãæ´æ°ãããããã§ã¯ããã¾ããã ããã¾ã§ããã¼ã«ã«ãªãã¸ããªãæ´æ°ãããã ãã§ãã ãã£ã¨è©³ããããã¨ãä¾ãã°masterãã©ã³ãã使ã£ã¦ããã®ã§ããã°ã origin/masterãæ´æ°ãããã¨ãããã¨ã§ãã masterã¨origin/masterã®éã masterã¯ãä¾ãã°ãã¼ã«ã«ã®ãã¡ã¤ã«ãæ´æ°ãã¦ã³ãããããå ´åã«ã¯maste
â» ã追è¨ãããã ãã¶å¤ãæ å ±ã§ãã Git ã® pull 㯠fetch + merge ã¨åãã¨ããã®ãããç®ã«ãã¾ãããèªåã®ä¸ã§ã¯éãæ°ããã¦ãã¦æ··ä¹±ãã¦ããã®ã§æ´çãã¦ã¿ã¾ãã èªèã誤ã£ã¦ããç¹ãªã©ããããã¾ãããããææããã ããã°å¹¸ãã§ãã 3種é¡ã®ãã©ã³ã ãã®è¨äºã§ã¯ Git ã® 3 種é¡ã®ãã©ã³ãã以ä¸ã®ããã«è¡¨ç¾ãã¾ãã ãªã¢ã¼ããã©ã³ã ãã©ããã³ã°ãã©ã³ã ãã¼ã«ã«ãã©ã³ã ãªã¢ã¼ããã©ã³ã ãªã¢ã¼ãã®ãªãã¸ããªã§å®ç¾©ããã¦ãããã©ã³ãã®ãã¨ãæãã¾ãã ãã©ããã³ã°ãã©ã³ã ãªã¢ã¼ããã©ã³ãã追跡ãããã¼ã«ã«ãªãã¸ããªã§å®ç¾©ããã¦ãããã©ã³ããæãã¾ãã ãã¼ã«ã«ãã©ã³ã ãã©ã³ããåã£ãããã³ããããªã©ããã¦ããå®éã«ä½æ¥ããããã¼ã«ã«ãªãã¸ããªã§å®ç¾©ããã¦ãããã©ã³ããæãã¾ãã ããããå³ã«ããã¨ä»¥ä¸ã®ãããªæãã§ãã fetch + merge ã®æå
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}