创远程仓库
在项目中git init
关联远程仓库 git remote add origin 地址
git add .
git commit -m “内容”
更新项目,避免与远程仓库冲突
git pull --rebase origin master
git push origin master
git 2.24版本存在这样的问题,更新git项目中的子模块会报错,导致不成功,错误如下
error: filename in tree entry contains backslash: '\'

解决办法:
git config --global core.protectNTFS falsegit config commit.template [模板文件名]
先切到master
git checkout master
查看本地已有的和远端的所有分支
git branch -a
git push origin --delete 分支名
git branch -d 分支名 //有可能会提示使用-D的命令 git branch -D 分支名
1.使用git branch -a查看本地和远程分支,会发现有些已经在远程仓库删除的分支,本地依旧能看到
2.查看本地分支与远程分支的关系
git remote show origin
3.删除远程仓库已经不存在的分支
git remote prune origin
1.进入tortoise的设置界面-->点击 Re-run First Start Wizard

一直next(下一步),直到 Authentication an credential store界面,设置ssh为OpenSSH方式,完成

1.清除本地项目缓存
git rm -r --cached .
2.新建.gitignore文件
touch .gitignore
3.再次提交所有文件
git add . git commit -m "add ignore"
4.提交到远端
git push
重命名本地分支
git branch -m oldBranch newBranch
删除远端分支
git push --delete origin oldBranch
将本地已重命名的分支推到远端
git push origin newBranch
切换到新分支
git checkout newBranch
关联本地和远端的分支
git branch --set-upstrean-to=origin/newBranch
gitgit tag -l git tag -l "v1.1.1*" //筛选出v1.1.1开头的tag git ls-remote -t //查看远端tags
gitgit tag -a [tagName] -m '[注释]' //给某次提交加tag git tag -a [tagName] [commitid]
gitgit push origin [tagName] //推送所有本地tag到远端 git push origin --tags
删除tag
删除本地tag
gitgit tag -d [tagName]
删除本地所有tag
gitgit tag -l|xargs git tag -d //拉取远端所有tag git fetch origin --prune
删除远端tag
git//方式一 git push origin :refs/tags/[tagName] //方式二 git push origin --delete [tagName]
在clone 仓库的时候报:SSL certificate problem: unable to get local issuer certificate
大概就是 SSL证书过期导致的
解决办法:
直接关闭SSL证书校验
gitgit config --global http.sslVerify false
本文作者:呵呵到天亮
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!