git常用指令

1.git创建

  1. git config user.name " name "        git config user.email "ddd@gmai.com"
  2. mdkdir  新建文件夹       touch  新建文件         git init   git初始化
  3. git rm  + 文件名      远程删除文件           rm + 文件名   本地删除文件            

2.git 缓存

  1. git add ./git add + 文件名   添加缓存
  2. git commit -m "   "  将缓存添加到本地分支
  3. git checkout ./git checkout   -- +文件名   取消修改
  4. git diff  对比缓存区和工作区            git diff -- cached         git diff HEAD  -- file.text

3.git 分支

  1. git checkout + 分支名
  2. git checkout -b + 分支名 新建并切换分支
  3. git checkout -d + 分支名 删除分支
  4. git branch  查看分支   
  5. git merge --on-ff -m "  "  dev          禁止Fast Forward的合并
  6. git merge vue-game-1 --allow-unrelated-histories   合并未关联的分支

4.git 版本

  1. git log   / git log --pretty=oneline  查看提交信息(commit)

  2. git log --graph  查看分支合并图
  3. git reflog  查看操作指令信息
  4. git reset --hard HEAD^     git reset --hard + commt id

5.git stash

  1. git stash  未进入git add 状态时离开工作区 
  2. git stash list   stash状态记录           git stach pop 进入最近的stash状态

6.git 远程

  1. git remote add origin + 地址
  2. git pull  拉取  
  3. git push origin master 
  4. git push -u origin master
  5. git remote -v
  6. 建立本地分支和远程分支的关联,使用git branch --set-upstream branch-name origin/branch-name
  7. git push origin --delete xuluchun8-vue-game-1  删除远程分支

参考https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000 廖雪峰

http://www.ruanyifeng.com/blog/2014/06/git_remote.html  阮一峰

转载于:https://www.cnblogs.com/xuluchun/p/9019929.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值