Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1168|回复: 0

Git 常用命令

[复制链接]

15

主题

15

帖子

231

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
231
发表于 2019-5-23 10:21:45 | 显示全部楼层 |阅读模式
1. 远程地址变更
1.1 查看远程地址:git remote -v
1.2 添加远程地址:git remote add origin "url地址"
1.3 删除远程地址:git remote rm origin

2. tag使用
1.1 新增tag: git tag -a v1.0.0 -m "第一次tag"
1.2 上传tag: git push origin v1.0.0
1.3 删除本地tag: git tag -d v1.0.0
1.4 删除远程tag: git push origin :refs/tags/v1.0.01.5 查看远程tag: git ls-remote --tags origin
1.6. 从tag上创建新分支: git pull(在master上,获取所有的状态,然后就能根据tag创建分支) && git checkout -b nicolas v1.0.0

3. 创建分支并提交到远程仓库
3.1 创建分支: git checkout -b test
3.2 提交分支: git push origin test:test //远程服务器上自动创建test分支

4. 删除远程分支 如:test分支
4.1. 切换到其他分支: git checkout master
4.2. 删除分支: git push origin :test
5. git submodule 删除
  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes:
    git add .gitmodules
  • Delete the relevant section from .git/config.
  • Remove the submodule files from the working tree and index:
    git rm --cached path_to_submodule (no trailing slash).
  • Remove the submodule's .git directory:
    rm -rf .git/modules/path_to_submodule
  • Commit the changes:
    git commit -m "Removed submodule <name>"
  • Delete the now untracked submodule files:
    rm -rf path_to_submodule



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Comsenz Inc.

GMT+8, 2025-8-4 07:12 , Processed in 0.011667 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表