美文网首页
git 常用命令

git 常用命令

作者: 阿木马克 | 来源:发表于2017-12-05 10:43 被阅读9次

一、.gitignore规则不生效的解决办法

每次修改.gitignore忽略配置文件后,执行以下命令:

git rm -r --cached .
git add .
git commit -m 'update .gitignore'

二、Checkout操作被拒绝时如何处理:

  1. 先提交修改,再切换
git commit -all
git checkout target-branch
  1. 先储存修改,在切换
git stash
git checkout target-branch

三、重置分支指针

//git stach (必要时先储存)
git reset --hard abf12f4

四、在合并或者解决冲突时出错,应该撤销合并:

git reset --merge

相关文章

网友评论

      本文标题:git 常用命令

      本文链接:https://www.haomeiwen.com/subject/ddpqixtx.html