git上传文件方法

背景:github是一个非常好用的代码仓库,上面可以看到很多大佬写的代码基本都是开源的,我们一般使用Jenkins持续构建的时候会调用git的脚本,所以首先我们需要将本地的代码提交到git仓库
    首先需要官网https://git-scm.com/下载对应客户端安装包进行安装,然后需要在https://github.com/注册一个账号 1.第一次提交git代码方法,需要在你需要上次文件的地方初始化,初始化后会生成一个.git的文件,然后就可以使用cmd进入该文件夹下进行对应操作
  第一步 git init  
  第二步 git add *
  第三步 git commit -m "备注修改记录"
  第四步 git config --global user.email "you@example.com"
  第五步 git config --global user.name "Your Name"
  第六步 git remote add origin https://github.com/13058038021/jack
  第七步 git push -u origin master

2.后续日常更新代码方法就比较简单了
  第二步 git add *
  第三步 git commit -m "备注修改记录"
  第一步 git pull
  第四步 git push origin master

3.其他常用方法
  1)遇到提出重复:    git remote rm origin
  2)从git克隆到本地: git clone https://github.com/13058038021/jack
  3)创建分支:        git checkout -b dev
  4)查看当前分支:    git branch 
  5)切换分支        git checkout master

 

 

posted @ 2020-06-14 23:20  one*love  阅读(791)  评论(0编辑  收藏  举报