git 上传代码到码云
與碼云建立連接教程:http://blog.csdn.net/zengmingen/article/details/76045076
如果完成了上面步驟的,且有了git。上傳項(xiàng)目步驟:
代碼提交
代碼提交一般有五個(gè)步驟:
1.查看目前代碼的修改狀態(tài)
2.查看代碼修改內(nèi)容
3.暫存需要提交的文件
4.提交已暫存的文件
5.同步到服務(wù)器
1.?????查看目前代碼的修改狀態(tài)
提交代碼之前,首先應(yīng)該檢查目前所做的修改,運(yùn)行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.?????查看代碼修改的內(nèi)容
?git diff? <file>
比較某文件與最近提交節(jié)點(diǎn)的差異。
注意:如果該文件已暫存,那么應(yīng)該使用git diff –cached<file>
?
?git diff <hashcode> <hashcode>? <file>
比較某文件在提交節(jié)點(diǎn)a,節(jié)點(diǎn)b的差異。
技巧:如果省略后面一個(gè)hashcode,則默認(rèn)表示與上一提交節(jié)點(diǎn)比較。(也可以利用^運(yùn)算符)
?
3.?????暫存需要提交的文件
如果是新建的文件
則git add? <file>
如果是修改的文件
則git add? <file>
如果是刪除的文件
則 git rm? <file>
4.?????提交已暫存的文件
git commit
注意注釋填寫規(guī)范。
git commit --amend
修改最近一次提交。有時(shí)候如果提交注釋書寫有誤或者漏提文件,可以使用此命令。
5.?????同步到服務(wù)器
同步到服務(wù)器前先需要將服務(wù)器代碼同步到本地
命令: git pull
如果執(zhí)行失敗,就按照提示還原有沖突的文件,然后再次嘗試同步。
命令:git checkout -- <有沖突的文件路徑>
同步到服務(wù)器
命令: git push origin? <本地分支名>
如果執(zhí)行失敗,一般是沒有將服務(wù)器代碼同步到本地導(dǎo)致的,先執(zhí)行上面的git pull命令。
操作例子:
復(fù)制這行代碼,到你本地,找個(gè)文件夾,開始clone吧
#cd ~/gitosproject #git clone git@git.oschina.net:ifengye/test.git
看到這行,說(shuō)明遠(yuǎn)程倉(cāng)庫(kù)的代碼已經(jīng)被clone下來(lái)啦!
#cd test下面開始擼代碼吧,啪啪啪啪啪啪啪啪,好了,擼完了,我們來(lái)提交我們的代碼哈~
提交項(xiàng)目
一個(gè)好習(xí)慣,不管這個(gè)項(xiàng)目多少人參與,push之前先pull一下,看看有沒有merge的代碼,有merge解決merge,沒有的話直接下面的命令
#git pull origin master #git add . #git commit -m 'init' #git push origin master
OK,下面我們?nèi)タ聪麓a是不是被添加上來(lái)了~
看到這個(gè)界面,我就放心了,因?yàn)槲抑霸趃itos上搞過(guò)事,就用的之前的賬戶提交的代碼,如果你有很多員工需要提交代碼,那么你可以在設(shè)置里面添加他們的賬號(hào)進(jìn)來(lái),給他們讀寫代碼的權(quán)限。總之,碼云還是很給力的。開心的擼代碼吧,以后到哪都可以擼代碼啦,好開心~~~
---------------------------
$ 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 "三大報(bào)表完成"
[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] 三大報(bào)表完成
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)
總結(jié)
以上是生活随笔為你收集整理的git 上传代码到码云的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 绩效考核编写说明
- 下一篇: 我是Leader,我被降职成了普通员工,