美文网首页
Git-命令集合

Git-命令集合

作者: yuyangkk | 来源:发表于2019-04-23 15:24 被阅读0次

先来一张图网上的图镇楼


git 命令.jpg

1. 删除远程已经存在的文件

删除缓存

git rm -r --cache somepath/文件名
eg. git rm -r --cache .DS_Store

commit

git commit -a "删除并停止追踪.DS_Store"

提交到远程

git push develop origin/develop

2. 分支重命名

同事A操作

  1. 重命名分支
KayedeMacBook-Pro:gittest kaye$ git branch -m oldbranch newbranch
KayedeMacBook-Pro:gittest kaye$ git branch 
  develop
  master
* newbranch
  1. 删除远程分支
KayedeMacBook-Pro:gittest kaye$ git push origin -d oldbranch
To https://github.com/yuyangkk/gittest.git
 - [deleted]         oldbranch
  1. 推送到远程并绑定
KayedeMacBook-Pro:gittest kaye$ git push --set-upstream origin newbranch
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3), 268 bytes | 268.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: 
remote: Create a pull request for 'newbranch' on GitHub by visiting:
remote:      https://github.com/yuyangkk/gittest/pull/new/newbranch
remote: 
To https://github.com/yuyangkk/gittest.git
 * [new branch]      newbranch -> newbranch
Branch 'newbranch' set up to track remote branch 'newbranch' from 'origin'.

同事B、C、D... 操作

  1. 查看远程变动
KayedeMacBook-Pro:gittest kaye$ git remote show origin
* remote origin
  Fetch URL: https://github.com/yuyangkk/gittest.git
  Push  URL: https://github.com/yuyangkk/gittest.git
  HEAD branch: master
  Remote branches:
    develop                       tracked
    master                        tracked
    newbranch                     tracked
    refs/remotes/origin/oldbranch stale (use 'git remote prune' to remove)
  Local branches configured for 'git pull':
    develop   merges with remote develop
    master    merges with remote master
    oldbranch merges with remote oldbranch
  Local refs configured for 'git push':
    develop pushes to develop (up to date)
    master  pushes to master  (up to date)
  1. 同步
KayedeMacBook-Pro:gittest kaye$ git remote prune origin
Pruning origin
URL: https://github.com/yuyangkk/gittest.git
 * [pruned] origin/oldbranch
KayedeMacBook-Pro:gittest kaye$ git branch -a
  develop
  master
* oldbranch
  remotes/origin/develop
  remotes/origin/master
  remotes/origin/newbranch
  1. 重命名
git branch -m oldbranch newbranch
  1. 绑定
git branch --set-upstream-to=origin/newbranch newbranch

相关文章

  • Git-命令集合

    先来一张图网上的图镇楼 1. 删除远程已经存在的文件 删除缓存 commit 提交到远程 2. 分支重命名 同事A...

  • Git-简单命令

    创建新仓库 创建新文件夹,打开,然后执行 以创建新的 git 仓库。 有远程仓库的也可以直接 列出远程仓库 查看远...

  • Git-基础命令

    git,对于一个开发者来说是一个经常会接触的知识点。但是自己似乎对于git的命令行使用还了解的不是很透彻,一个很尴...

  • Git-常见命令

    一、背景 本文适用于快速了解git提交代码流程、克隆项目、创建分支等操作命令,了解git原理&下载请移步git官网...

  • 常用命令

    字符串命令 string类型 列表命令 list类型 集合命令 set类型 有序集合命令 zset类型 散列命令...

  • Redis 集合(Set) 命令

    Redis 集合(Set) 命令 下表列出了 Redis 集合基本命令: 1> sadd 命令:向集合添加一个或多...

  • GIT-常用指令集合

    GIT 常用指令合集 1. 本地新建文件夹 2. 从远程仓库克隆到本地 git clone 地址(https或s...

  • Git-常见操作命令

    新建一个仓库,并且该仓库应该是git类型 新建文件并放入git仓库 git的日志和跟踪管理 git版本的回退 gi...

  • Git-简单命令使用

    Git commit -m "" 只会提交添加到缓存区的文件(只提交添加的) git commit -a -m "...

  • Redis实战-Redis五种数据类型(四-1 字符串)

    本节主要内容 字符串命令 列表命令 集合命令 散列命令 有序集合命令 1.字符串(string)   Redis ...

网友评论

      本文标题:Git-命令集合

      本文链接:https://www.haomeiwen.com/subject/oyivgqtx.html