天天看點

git 常用指令

  一、Git(讀音為/gɪt/。)是一個開源的分布式版本控制系統,可以有效、高速地處理從很小到非常大的項目版本管理。 [1]  Git 是 Linus Torvalds 為了幫助管理 Linux 核心開發而開發的一個開放源碼的版本控制軟體。

  二、相信使用過svn的版本控制,我覺得很大程度上都會覺得他是很強大的。git做為開源的版本管理方式,我個人還是非常喜歡的。

  三、常用指令

  1)初始化

git init      

  2)添加檔案 (.)為目前目錄所有檔案,當然可以指定目錄

git add .      

  3)本地送出

git commit -m "送出"      

  4)設定遠端位址

git remote add origin "git位址"      

  5)同步本地檔案到遠端

git push -u origin master      

  6)同步遠端檔案到本地

git pull --rebase origin master      

  7)拉取遠端代碼

git clone <git_address>      

  8)拉取分支代碼

git clone -b <branch_name> <git_address>      

  9)常見錯誤

error: git upload-pack: git-pack-objects died with error
fetal: git upload-pack: aborting due to possible repository corruption on the remote side.
remote: aborting due to possible repository corruption on the remote side
fetal: early EOF
fetal: index-pack failed
      

  解決:

git config --global pack.windowMemory "100m"
git config --global pack.SizeLimit "100m" 
git config --global pack.threads "1"
git config --global pack.window "0"      

  四、上面是常用的指令,更多指令可以參考

  https://git-scm.com/book/zh/v2:官網

  http://www.runoob.com/git/git-tutorial.html:菜鳥教程

  

git