Git相关资源

Git官网: https://git-scm.com

TortoisGit官网:https://tortoisegit.org

Sourcetree官网:https://www.sourcetreeapp.com/

Git命令(官方网站: https://git-scm.com/docs

删除远程仓库的地址
$ git remote rm origin
重置到提交 (恢复到f4df19d提交)
$ git reset --hard f4df19d
重置到远程自己最后一次提交(有可能会抹掉别人的提交)
$ git push origin HEAD --force
取消上一次本地提交(同时清空提交的内容)
$ git reset HEAD~ && git checkout . && git clean -xdf
清除本地提交
$ git reset --hard FETCH_HEAD
清除缓存区所有的内容(不包含本地提交)
$ git checkout . && git clean -xdf

添加远程地址(比如远程地址:git@git.kjwoo.cn:bowen/test.git)
$ git remote add origin git@git.kjwoo.cn:bowen/test.git
修改远端地址
$ git remote set-url origin xxx

使用yum安装git2.X(wandisco的yum源)
[root@wkjhost ~]# yum install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-1.noarch.rpm
[root@wkjhost ~]# yum install git

git push到远程分支时报错error: RPC failed; HTTP 411 curl 22 The requested URL returned error: 411 Length Req
git config http.postBuffer 524288000

清理本地存储
$ git gc --prune=now
$ git remote prune origin

使用合并策略

git config --global pull.rebase true
git config --global branch.autoSetupRebase always

标签

//创建标签
git tag -a 标签名字 -m "标签注释"
//推送所有的分支到远端
git push origin --tags

sourcetree 还原配置

确保SourceTree已关闭。
  
确保在删除文件之前在以下文件夹中备份文件
  
删除~/Library/Application Support/SourceTree/
中的所有内容   
删除~/Library/Preferences/com.torusknot.SourceTreeNotMAS.plist(您应该使用SourceTree的直接版本,因此“NotMAS”)

标签: none

添加新评论