自用git指令笔记

一键拉取本地上不存在的远程分支:

  git checkout -b br
  git pull origin br
查看本地以及远程分支:

 git branch -a
删除远程分支:

 git push origin :br  (origin 后面有空格)
删除远程仓库中的提交版本

git reset --hard 版本号
git push origin master -f
本地拉取远端git pull出错:

> Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'

如果想放弃本地的文件修改,可以使用git reset --hard FETCH_HEAD,FETCH_HEAD表示上一次成功git pull之后形成的commit点。然后git pull就OK了。
.gitconfig配置:

[alias]
co = checkout
ci = commit
ci0 = commit -a --allow-empty-message -m ''
st = status
br = branch
pl = log --pretty=oneline
rpl = reflog --pretty=oneline
back = reset --hard
[user]
    name = weber-Huang
    email = [email protected]

猜你喜欢

转载自blog.csdn.net/dokill/article/details/78175537
今日推荐