git 上传代码到码云

与码云建立连接教程: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)


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

松门一枝花

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值