资讯专栏INFORMATION COLUMN

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

Ocean / 641人阅读

摘要:欢迎进入全栈之路之版本控制基础课程博客地址本系列文章将主要针对代码的版本控制进行讲解,希望对广大同行带来一些帮助。下面将重点介绍实际项目中如何提交代码至远程仓库。

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

博客地址: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

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/75249.html

相关文章

  • Git基础知识教程整理(Git基本操作)

    摘要:简介是目前世界上最先进的分布式版本控制系统没有之一。查看所有分支的版本操作记录。工作区直接删除文件,提交到版本库。与他人协作涉及管理远程仓库以及根据需要推送或拉取数据。克隆远程仓库支持多种协议,默认使用,也可以使用等其他协议。 Git简介 Git是目前世界上最先进的分布式版本控制系统(没有之一)。Linux之父Linux用C语言写了Git分布式版本控制系统。 分布式版本控制系统与集中式...

    187J3X1 评论0 收藏0
  • Git 实用指南

    摘要:个人整理的一些常用的概念和命令集合,方便速查和快速解决某些场景下的问题,覆盖了日常开发和协同工作下的一部分场景,不只是命令行的介绍。常用命令创建一个空白的仓库指的是本地的仓库关联的远程仓库。 个人整理的一些常用的 Git 概念和命令集合,方便速查和快速解决某些场景下的问题,覆盖了日常开发和协同工作下的一部分场景,不只是命令行的介绍。欢迎关注语雀原文,持续更新! 精简入门 1、克隆仓库...

    qpal 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<