ssh key
用git删除tag的方法如下: 1 2 3 4 5 # 删除本地tag git tag -d 1.0.0 # 删除远程tag git push origin :refs/tags/1.0.0
用户信息 第一个要配置的是你个人的用户名称和电子邮件地址。这两条配置很重要,每次 Git 提交时都会引用这两条信息,说明是谁提交了更新,所以会随更新内容一起被永久纳入历史记录:
1 2 3 git config --global user.name "admin" git config --global user.email [email protected]
本地项目指向新的源 1 2 git remote set-url origin <https://gitlab.google.com/mobileios/Pandora.git>
避免使用git pull
或 git push
提示输入账号和密码 1 2 git config --global credential.helper osxkeychain
切换到指定的Commit 1 git reset --hard commitID
Git切换到分支 1 git checkout -b newbranch
Git合并分支 1 2 git checkout master git merge newbranch
Git clone SSL 错误解决 忽略掉SSL验证
1 2 git config --global http.sslVerify false
Git rebase 使用 1 2 // 对git的前三步做处理 git rebase -i HEAD~3
Git 修改指定提交 reword fecb551 Init the view model
重排提交 1 2 3 4 5 6 7 8 pick fecb551 Init the view model pick bb199a0 Update the version pick bc5cd9d Add new method ... //改为: pick bc5cd9d Add new method pick fecb551 Init the view model
合并提交 1 2 3 4 pick fecb551 Init the view model squash bb199a0 Update the version squash bc5cd9d Add new method
拆分提交 1 2 3 4 pick fecb551 Init the view model edit bb199a0 Update the version pick bc5cd9d Add new method
清空仓库 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1.Checkout git checkout --orphan latest_branch 2. Add all the files git add -A 3. Commit the changes git commit -am "commit message" 4. Delete the branch git branch -D master 5.Rename the current branch to master git branch -m master 6.Finally, force update your repository git push -f origin master
HTTPS 自颁发SSL证书验证失败 git config –global http.sslVerify false
git 下载子模块 git submodule update –init –recursive
git 添加多个仓库 1 2 git remote add origin 地址 git remote set-url origin --push --add 地址
删除本地tag
删除远程tag 1 git push origin :refs/tags/rc-5.3.0.7
删除远程分支 1 2 git branch -r -d origin/branch-name git push origin :branch-name
git 优雅的撤销中间某次提交 1 2 3 4 5 6 7 8 9 10 11 12 git revert commit_id //如果commit_id是merge节点的话,-m是指定具体哪个提交点 git revert commit_id -m 1 //接着就是解决冲突 git add -A git commit -m ".." git revert commit_id -m 2 //接着就是解决冲突 git add -A git commit -m ".." git push
创建一个 pod lib 工程 1 pod lib create KSCapeKit
git patch 1 2 3 4 5 6 git format-patche 795fefabc git am --abort git am patch
git 撤销某一次提交 1 2 3 4 5 6 7 8 9 10 11 git revert commit_id //如果commit_id是merge节点的话,-m是指定具体哪个提交点 git revert commit_id -m 1 //接着就是解决冲突 git add -A git commit -m ".." git revert commit_id -m 2 //接着就是解决冲突 git add -A git commit -m ".." git push