欢迎进入全栈之路之版本控制基础课程
博客地址:https://blog.csdn.net/houjiyu...
本系列文章将主要针对代码的版本控制进行讲解,希望对广大同行带来一些帮助。若有问题请及时留言或加QQ:243042162。
寄语:
如果你不去希望,你就不会发现什么东西超出了你的希望。
背景
项目建立初期都是先搭建基础框架,再把代码放到代码管理服务器上,让项目组成员进行检出从而进行需求的开发。下面将重点介绍实际项目中如何提交代码至git远程仓库。
步骤
-
1.下载安装git
自己本身系统是win10,下载地址:https://git-for-windows.githu... - 2.初始化版本库:git init
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
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。