1087 git init —bare study.git <=== crate study.git 1088 ls study.git/ 1089 cat study.git/config 1090 ls 1091 git clone study.git/ 1092 ls 1093 cd study 1094 ls 1095 touch study.readme 1096 echo “This is readme for study(master)” 1097 echo “This is readme for study(master)” >>study.readme 1098 git add study.readme 1099 git commit -s study.readme <===== commit a file for test. 1100 git push origin master <===== push them to the server(locally). 1101 cd .. 1102 ls
##create a remote branch.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1103 git clone study.git/ tmp1 1104 cd tmp1/ 1105 ls 1106 git log 1107 cd .. 1108 ls 1109 cd study 1110 ls 1111 git checkout -b dev_junwei <======== create a locally branch. 1112 ls 1113 vim study.readme 1114 ls 1115 git commit study.readme 1116 git mv study.readme study.dev.junwei.readme 1117 git push origin dev_junwei <======== create a remote branch. and remote branch has same name with the local one. 1118 git branch
##create a mirror for the study.git
1
git clone —bare study.git/ mirror.git
##Add a new remote git resp.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
1134 git remote add mirror /home/junwei/git_study/mirror.git/ <=== add a new remote and name it as mirror. 1136 git remote show 1137 git remote show origin 1138 git remote show mirror 1139 git status 1140 git fetch mirror <===== !!!! important, Only thus following checkout could be sucess
1141 git checkout -b m_master mirror/master <=== create local branch according remote branch. 1142 git checkout -b m_dev mirror/dev_junwei
1164 git commit -sa <=== commit a change to local branch.
1168 git push mirror m_dev:dev_junwei <=== push the local change to remote branch. "m_dev" is created in 1142.
1174 git push mirror m_dev:dev_junwei <=== do some change/commit and push again to remote mirror. FU CK( NOT m_dev/dev_junwei)!!!!!!!