git常用命令
1、修改远程仓库地址
git remote set-url origin http://192.168.1.2/xxxxx/new_name.git
2、添加新的远程仓库
git remote add origin http://192.168.1.2/xxxxx/new_name.git
3、修改远程仓库名称
git remote rename origin old-origin
4、删除分支
git branch -D dev_test
git push origin --delete dev_test
git remote prune origin //删除远程不存在本地存在的remote分支
5、查看最新操作记录
git reflog
6、将当前修改提交到新的分支
git stash //步骤1:在当前的master分支上的修改暂存起来
git checkout -b new_branch//步骤2:暂存修改后,在本地新建new_branch为新分支名称)
git stash pop//步骤3:将暂存的修改放到新建分支中
git add ....&& git commit ....//步骤4:提交修改
git push//步骤5:将提交的内容push到远程服务器
7、git不使用http、https代理,禁用ssl校验
git config --global --unset http.proxy
git config --global --unset https.proxy
git config --global http.sslverify false
8、子仓库一起克隆
git clone --recursive --progress xxxx
git submodule update --init --recursive --progress 失败后继续
9、git 配置
git config --global --list //显示所有全局配置
git conifg --global --unset ... //删除某个配置
git conifg --global ... //配置某个值
示例取消ssl校验
git config --global http.sslverify false
git config --global https.sslverify false
文件名、commit中文支持
git config --global core.quotepath false
10、导出修改的文件
git xxxxxxxx xxxxxxxx --name-only | xargs zip modify.zip
----------------------------------------------------------------------------------------------------------------------
reop常用命令
1、repo还原撤消所有修改
repo forall -c 'git reset --hard;git clean -df;git rebase --abort'
2、repo切换分支
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-11.0.0_r46
repo sync