ã¿ã¤ãã«ã©ããã®ãããã¯ã§ã
Gitã«ã¯ä¾¿å©ãªãã¨ã«git-worktree(1)ãåå¨ãã。ããã、æ®éã«git-cloneãã¦ããã¬ãã¸ããªã®ä¸ã§git-worktreeã§ä»ã®ãã©ã³ãããã§ãã¯ã¢ã¦ããã¦ããã¨、å½ç¶ã ãgitã¨ãã¦ã¯ãã®ãã§ãã¯ã¢ã¦ããã¦ããå¥ã®ãã©ã³ãã®ãããã£ã¬ã¯ããªãã¾ãã£ã¨untracking filesã«åºã¦ãã¦、大å¤ã¸ã£ããªãã¨ãã®ä¸ãªã、ã¨ããæ¬ ç¹ãããã®ã§ãã……
解決æ¹æ³
git-clone(1)ã«ã¯ããã¤ãcloneã®æ¹æ³ããã。--mirror
ã--bare
ãªã©ã§ãã。ä»åã¯--bare
ãåãä¸ãã。
mkdir my_project
cd my_project
git clone --bare [email protected]/orumin/my_project .bare
ãã®ããã«cloneããã¨、my_project/.bareé ä¸ã«gitã®ã¬ãã¸ããªæ¬ä½ã ããcloneããã。ã¬ãã¸ããªã§ç®¡çããã¦ãããã¡ã¤ã«ç¾¤ãã³ããããå ¨ã¦gitã¬ãã¸ããªã§git objectã¨ãã¦ç®¡çããã¦ããç¶æ ã«ã®ã¿ãªã£ã¦ãã、ãã¡ã¤ã«ã®å®ä½ã¯ã©ãã«ãcheckoutããã¦ããªãç¶æ ã¨ãªã
cd my_project
echo "gitdir: .bare" > .git
git worktree add main
ããããã¨、å®éã¯gitã¬ãã¸ããªã§ã¯ãªãmy_projectãã£ã¬ã¯ããªç´ä¸ã«å±
ãã¨ãã§ãgitã¬ãã¸ããªã¨ãã¦gitã³ãã³ããèªèãã¦ãããã®ã§、git-worktree(1)
ãå©ç¨ã§ããç¶æ
ã¨ãªã£ã¦ãã。ãã®å ´å、ããã§git worktree add main
ããããã¨ã§、my_project/main
ã¨ãããã£ã¬ã¯ããªã«origin/main
ã®ãã©ã³ããcheckoutããã¦、gitã§ç®¡çãã¦ãããã¡ã¤ã«ç¾¤ã«ã¢ã¯ã»ã¹ã§ããããã«ãªã。åæ§ã«、ä»ã®ãã©ã³ãã«é¢ãã¦ãmy_project
ç´ä¸ã§git worktree add
ããã°ãã£ã¬ã¯ããªã®å½¢ã§ã½ãã½ããã©ã³ããcheckoutã§ãã、ã¨ããããã§ãã。
ã¾ã、
git worktree -b add_new_feature feature_branch origin/main
ãªã©ã¨ããã°、origin/main
ããã¼ã¹ã¨ãã¦æ°è¦ãã©ã³ãadd_new_feature
ãåã、ãããfeature_branch
ã¨ãããã£ã¬ã¯ããªåã§worktreeãä½æãã¦ããã。ã¹ãã!
remote branchãfetchã§ããªã!
以ä¸ã§ããããã«æãã、git-pull
ãªã©ãããã¨ãé端ã«å°ã£ãäºå®ã«ç´é¢ãã。remote branchãfetchã§ããªãã®ã§ãã。ããã¯、--bare
ã§ã¯ãªãæ®éã«git-clone
ããã¨ãã«è¨å®ãããå¤ã、git clone --bare
ã§ã¯è¨å®ãããªãããã§ãã。
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
ç°¡åã«è¨ãã°、ãã®è¨å®ã追å ããã°originã¨ãã¦è¨å®ãã¦ããremote repositoryã«å¯¾ãã¦git-fetch
ããã¨ãã¡ããã¨local repositoryã«ç´ä»ãã¦ãã¦ã³ãã¼ããã¦ãããããã«ãªã。ããã§、ãªã¼ã«ãªãã±ã¼!
ãã©ã³ããã¨ã«ãã£ã¬ã¯ããªãä½æãã……?
ã§ãããã£ã¦SVNã¿ãããããªãã§ãã?
ã¯ã……ã§ã便å©ã ã……