與碼云建立連接教程:http://blog.csdn.net/zengmingen/article/details/76045076
如果完成了上面步驟的,且有了git。上傳項目步驟:
代碼提交
代碼提交一般有五個步驟:
1.查看目前代碼的修改狀態
2.查看代碼修改內容
3.暫存需要提交的文件
4.提交已暫存的文件
5.同步到服務器
1.?????查看目前代碼的修改狀態
提交代碼之前,首先應該檢查目前所做的修改,運行Git?status命令
a)????????已暫存 (changes to be committed)
new file //表示新建文件
modified //表示修改文件
deleted //表示刪除文件
b)???????已修改 (changed but not updated)
modified //表示修改文件
deleted //表示刪除文件
另外,git?給出了可能需要的操作命令,git add/rm, gitcheckout --
c)????????未跟蹤 (untracked files)
??????
??????
2.?????查看代碼修改的內容
?git diff? <file>
比較某文件與最近提交節點的差異。
注意:如果該文件已暫存,那么應該使用git diff –cached<file>
??git diff <hashcode> <hashcode>? <file>
比較某文件在提交節點a,節點b的差異。
技巧:如果省略后面一個hashcode,則默認表示與上一提交節點比較。(也可以利用^運算符)
?
3.?????暫存需要提交的文件
如果是新建的文件
則git add? <file>
如果是修改的文件
則git add? <file>
如果是刪除的文件
則 git rm? <file>
4.?????提交已暫存的文件
git commit
注意注釋填寫規范。
git commit --amend
修改最近一次提交。有時候如果提交注釋書寫有誤或者漏提文件,可以使用此命令。
5.?????同步到服務器
同步到服務器前先需要將服務器代碼同步到本地
命令: git pull
如果執行失敗,就按照提示還原有沖突的文件,然后再次嘗試同步。
命令:git checkout -- <有沖突的文件路徑>
同步到服務器
命令: git push origin? <本地分支名>
如果執行失敗,一般是沒有將服務器代碼同步到本地導致的,先執行上面的git pull命令。
操作例子:
復制這行代碼,到你本地,找個文件夾,開始clone吧
#cd ~/gitosproject #git clone git@git.oschina.net:ifengye/test.git
看到這行,說明遠程倉庫的代碼已經被clone下來啦!
#cd test下面開始擼代碼吧,啪啪啪啪啪啪啪啪,好了,擼完了,我們來提交我們的代碼哈~
提交項目
一個好習慣,不管這個項目多少人參與,push之前先pull一下,看看有沒有merge的代碼,有merge解決merge,沒有的話直接下面的命令
#git pull origin master #git add . #git commit -m 'init' #git push origin master
OK,下面我們去看下代碼是不是被添加上來了~
看到這個界面,我就放心了,因為我之前在gitos上搞過事,就用的之前的賬戶提交的代碼,如果你有很多員工需要提交代碼,那么你可以在設置里面添加他們的賬號進來,給他們讀寫代碼的權限。總之,碼云還是很給力的。開心的擼代碼吧,以后到哪都可以擼代碼啦,好開心~~~
---------------------------
$ git add .
warning: LF will be replaced by CRLF in .idea/workspace.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/app.component.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/app.module.ts.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart/chart.component.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart/chart.component.ts.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in tsconfig.json.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart2/chart2.component.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart2/chart2.component.spec.ts.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart2/chart2.component.ts.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart3/chart3.component.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart3/chart3.component.spec.ts.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart3/chart3.component.ts.
The file will have its original line endings in your working directory.
曾妙根@zengmiaogen MINGW64 /d/kuaipan/workspace_angular/dochart (master)
$ git commit -m "三大報表完成"
[master warning: LF will be replaced by CRLF in .idea/workspace.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/app.component.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/app.module.ts.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart/chart.component.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart/chart.component.ts.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in tsconfig.json.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .idea/workspace.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart/chart.component.ts.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart2/chart2.component.ts.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart3/chart3.component.ts.
The file will have its original line endings in your working directory.
ba26cff] 三大報表完成
warning: LF will be replaced by CRLF in .idea/workspace.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/app.component.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/app.module.ts.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart/chart.component.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart/chart.component.ts.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart2/chart2.component.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart2/chart2.component.spec.ts.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart2/chart2.component.ts.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart3/chart3.component.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart3/chart3.component.spec.ts.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/app/chart3/chart3.component.ts.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in tsconfig.json.
The file will have its original line endings in your working directory.
?36 files changed, 1109 insertions(+), 773 deletions(-)
?create mode 100644 src/app/chart2/chart2.component.css
?create mode 100644 src/app/chart2/chart2.component.html
?create mode 100644 src/app/chart2/chart2.component.spec.ts
?create mode 100644 src/app/chart2/chart2.component.ts
?create mode 100644 src/app/chart3/chart3.component.css
?create mode 100644 src/app/chart3/chart3.component.html
?create mode 100644 src/app/chart3/chart3.component.spec.ts
?create mode 100644 src/app/chart3/chart3.component.ts
?delete mode 100644 src/app/charts/column.ts
?create mode 100644 src/app/charts/cslcs_pie.ts
?create mode 100644 src/app/charts/csyhs_pie.ts
?delete mode 100644 src/app/charts/gauge.ts
?delete mode 100644 src/app/charts/line.ts
?delete mode 100644 src/app/charts/pie.ts
?create mode 100644 src/app/charts/xllcs_pie.ts
?create mode 100644 src/app/charts2/line_column.ts
?create mode 100644 src/app/charts3/line_line.ts
曾妙根@zengmiaogen MINGW64 /d/kuaipan/workspace_angular/dochart (master)
$ git push origin master
Counting objects: 42, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (39/39), done.
Writing objects: 100% (42/42), 9.71 KiB | 0 bytes/s, done.
Total 42 (delta 30), reused 0 (delta 0)
To git@git.oschina.net:zengmg/dochart2.git
? ?2479f60..ba26cff ?master -> master
曾妙根@zengmiaogen MINGW64 /d/kuaipan/workspace_angular/dochart (master)