git基础操作指令

git版本更新

git clone git://git.kernel.org/pub/scm/git/git.git

添加标签

$ git config --global user.name "jyz"
$ git config --global user.email jinyouzhi6@163.com

查看信息

git config --list

切换远程仓库地址

git remote set-url origin url #直接修改远程仓库地址

git remote rm origin #删除现有远程仓库
git remote add origin url #添加新远程仓库

git remote -v  #查看远程仓库地址
git tag v0.1.2-light  #创建轻量级标签
git tag -a v0.1 -m "version 0.1 released push url" d5a65e9  #创建附注标签
git show -a
git checkout [tagname/branchename]  #切换标签或branche
git tag -d v0.1..2  #删除标签
git log --pretty=oneline --abbrev-commit #查看历史提交commit id
git tag -a v0.1.1 9fbc3d0  #给指定commit打标签
git push origin v0.1.2 #提交标签
git push origin -tags 

版本回退

git reset --hard d5a65e #回退到指定commit id的版本

放弃本地修改

error: Your local changes to the following files would be overwritten by merge
git reset --hard
git pull

git log和git reflog 的区别:

git reflog 可以查看所有分支的所有操作记录(包括commit和reset的操作),包括已经被删除的commit记录,git log则不能察看已经删除了的commit记录

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值