git 基本操作

來源:互聯網
上載者:User

標籤:style   blog   http   java   color   strong   

windows安裝:

安裝好後,隨便點擊一個檔案夾,就會有git bash的右鍵選項。。。。 這個是cmd方式

還有git gui方式。。。

 

git clone 從某個分支上copy一份到本地。

git init 初始化—— 主要是產生.gitignore檔案等,表明此目錄是git專用

 

git add .    //將改動的地方添加到版本管理器 —— . 表示目前的目錄

git  commit -m "some changes"  //提交到本地的版本控制庫裡,引號裡面是你對本次提交的說明資訊。—— 遠程不會有任何變化

git push -u origin master  //將你本地的倉庫提交到你的github帳號裡,此時需要你輸入你的github的帳號和密碼,你輸入就是了 ——凡是涉及遠程‘敏感’操作的都會要求驗證身份

  —— origin  表示當前分支 的遠程倉庫  ( 名字當然不一定要是origin) ——  遠程倉庫是指。。。。 

  —— master   表示主幹分支  —— 一般預設以 master 為主幹

git pull origin master   —— 從遠程分支master(亦即主幹)發送pull請求, 拉取最新代碼到本地origin。

 

git remote add  ———— 這個有點不好理解———— 

http://blog.csdn.net/pgmsoul/article/details/7883706

 

 

git fetch ... 

git merge

 

 

 

參考:http://www.cnblogs.com/wenber/p/3630921.html

 

 

簡易的命令列入門教程:Git 全域設定:git config --global user.name "1310328554"git config --global user.email "[email protected]"建立 git 倉庫mkdir TestCcd TestCgit inittouch README.mdgit add README.mdgit commit -m "first commit"git remote add origin https://git.oschina.net/1310328554/TestC.gitgit push -u origin master已有項目?cd existing_git_repogit remote add origin https://git.oschina.net/1310328554/TestC.gitgit push -u origin master

 

 

HTTPS 和 SSH 兩種訪問方式效果一樣

為什麼有這個區別呢?

 

提供了不同協議, 以適合不同場合。。

 

如果遠程倉庫已經存在:

[email protected] /D/git/TestJava (master)
$ git remote add origin https://git.oschina.net/1310328554/TestD.git
fatal: remote origin already exists.

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.