【全栈之路】版本控制课程一_Git如何把本地代码推送到远程仓库(20190709v1.0)

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/houjiyu243042162/article/details/95186177

欢迎进入全栈之路之版本控制基础课程

博客地址:https://segmentfault.com/a/1190000019707348
本系列文章将主要针对代码的版本控制进行讲解,希望对广大同行带来一些帮助。若有问题请及时留言或加QQ:243042162。

寄语:
如果你不去希望,你就不会发现什么东西超出了你的希望。

背景

项目建立初期都是先搭建基础框架,再把代码放到代码管理服务器上,让项目组成员进行检出从而进行需求的开发。下面将重点介绍实际项目中如何提交代码至git远程仓库。

步骤

rain@DESKTOP-R3H1KFK MINGW64 /c/WebstormProjects/cmpy-project/project-center
$ git init
Initialized empty Git repository in C:/WebstormProjects/cmpy-project/p                                                                                      roject-center/.git/

  • 3.添加文件到版本库:git add .
rain@DESKTOP-R3H1KFK MINGW64 /c/WebstormProjects/cmpy-project/project-                                                                                                      center (master)
$ git add .
warning: LF will be replaced by CRLF in assets/css/font-awesome.min.css.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in assets/js/ie/html5shiv.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in assets/js/ie/respond.min.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in assets/js/jquery.min.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in assets/js/skel.min.js.
The file will have its original line endings in your working directory.

  • 4.提交到版本库,并填写提交备注:git commit -m "v1.0"
rain@DESKTOP-R3H1KFK MINGW64 /c/WebstormProjects/cmpy-project/project-center (master)
$ git commit -m "v1.0"
[master (root-commit) 260e147] v1.0
 53 files changed, 8306 insertions(+)

  • 5.把本地库与远程库关联:git remote add origin 你的远程库地址
rain@DESKTOP-R3H1KFK MINGW64 /c/WebstormProjects/cmpy-project/project-center (master)
$ git remote add origin 远程库地址
  • 6.推送至远程:git push -u origin master -f
rain@DESKTOP-R3H1KFK MINGW64 /c/WebstormProjects/cmpy-project/project-center (master)
$ git push -u origin master -f
Counting objects: 65, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (65/65), done.
Writing objects: 100% (65/65), 478.97 KiB | 0 bytes/s, done.
Total 65 (delta 2), reused 0 (delta 0)
  • 7.查看状态:git status
rain@DESKTOP-R3H1KFK MINGW64 /c/WebstormProjects/cmpy-project/project-center (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean

猜你喜欢

转载自blog.csdn.net/houjiyu243042162/article/details/95186177