20200808git整理

申请github用户 https://github.com/ 
下载git
一下载线上仓库项目到本地
1.在想要安放项目文件夹下打开gitbash命令窗口
2.指定git账号命令 git config --global user.name 'git用户名'
  指定git邮箱命令 git config --global user.email '注册git邮箱地址'
3.创建git本地仓库 git init
4.克隆项目到本地 git  clone  github项目地址
二 提交本地新项目到线上仓库
1.github先创建项目仓库
2.本地项目目录下打开gitbash命令窗口
3.指定git账号命令 git config --global user.name 'git用户名'
  指定git邮箱命令 git config --global user.email '注册git邮箱地址'
4.查看当前状态 git status 
  如提示
  fatal: Not a git repository (or any of the parent directories): .git
  执行 git init 创建本地仓库
5.将当前项目提交本地仓库 git  add  项目文件夹
6.提交版本 git cummit -m '注释内容'
7.上传 git push 
   如提示 
   fatal: No configured push destination.
   Either specify the URL from the command-line or configure a remote repository using
  需要使用指定线上仓库地址
  与origin master建立连接
   git remote add origin 'github仓库地址'  
   然后执行 git push 
   如提示 
   fatal: The current branch master has no upstream branch.
   To push the current branch and set the remote as upstream, use
   向指定分支提交版本 没有创建分支
   git push --set-upstream origin master
    
git restet HEAD 文件名    撤回暂存区  
git checkedout --文件名   撤回修改
HEAD指针指向最新版本
git reset--hard HEAD^    回到上一个版本 前两个版本^^ 递增
git reset--hard HEAD~1   同上 ~100前100个版本
回到指定版本
git reset--hard 版本编号 编号通过log日志查看 如果没有 通过git reflog 查看操作记录
git log 查看版本日志

每次commit 都是进行版本记录 每次记录都是针对上一版本进行 
git add . 提交更新全部文件
git branch -a查看所有分支
git checkout 分支名 切换githash 
touch 文件名 创建文件
三 创建分支
1.远程仓库github创建分支(也可提交时创建)
2.本地仓库创建分支 git fetch origin 分支名 
3.切换并创建gitbash到分支 git checkout -b 分支名
  已经创建 git checkout分支名
  分支切换需要提交当前修改
4. git push --set-upstream origin master 提交版本到指定分支 没有分支创建

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值