常用的git命令

git diff 工作区与暂存区的区别 

git remote -v 查看远程仓库地址

 

分支:

 git push <远程主机名> <本地分支名>:<远程分支名>

git branch 查看本地新支

git branch -a 查看远程分支和本地分支

git branch --all 查看所有分支

git branch issue 创建issue分支

git checkout issue  本地切换分支issue

git branch -d issue 本地删除分支issue

git push origin --delete <branchName> 删除远端分支

git checkout -b <branch> 创建分支并进行切换

git push origin localbranch:remotebranch 把本地的分支提交到远端分支

git remote set-url origin git@github.com:someaccount/someproject.git  修改远端https为ssh(如果已经连接远端仓库,并且用https链接)

git remote add origin ssh地址 将本地的仓库和远程的仓库进行关联

git remote -v 查看远端仓库的地址

git remote rm origin 和远端origin仓库断开连接

git branch -a 查看远端分支和本地分支

git remote rename <原主机名><线主机名> 用与远程主机的改名

git push -f origin master 强推 本地强制上传到远程,把远程的覆盖

git rm --cached 删除本地git缓存,gitignore不生效可以写这个命令

posted @ 2017-11-05 11:33  沙滩多啦图  阅读(168)  评论(0编辑  收藏  举报