zoukankan      html  css  js  c++  java
  • git分支管理

    查看远程分支

    $ git branch -a
    * master
      remotes/origin/HEAD -> origin/master
      remotes/origin/master
    

    查看本地分支

    $ git branch
    * master
    

    创建分支

    $ git branch test
    
    $ git branch
    * master
      test
    
    

    把分支推到远程分支

    $ git push origin test
    Total 0 (delta 0), reused 0 (delta 0)
    To https://git.xxx.xxx/xxx/xxx.git
     * [new branch]      test -> test
    

    切换分支到test

    $ git checkout test
    Switched to branch 'test'
    
    $ git branch
      master
    * test
    
    

    删除本地分支

    $ git checkout master
    Switched to branch 'master'
    Your branch is up-to-date with 'origin/master'.
    
    $ git branch -d test
    Deleted branch test (was aaadfcd).
    

    查看本地和远程分支

    git branch -a
    * master
      remotes/origin/HEAD -> origin/master
      remotes/origin/master
      remotes/origin/test
    

    在clone完成之后,Git 会自动为你将此远程仓库命名为origin(origin只相当于一个别名,运行git remote –v或者查看.git/config可以看到origin的含义),并下载其中所有的数据,建立一个指向它的master 分支的指针,我们用(远程仓库名)/(分支名) 这样的形式表示远程分支,所以origin/master指向的是一个remote branch(从那个branch我们clone数据到本地)

    执行 git remote -v 的结果,看出来origin其实就是远程的git地址的一个别名。

    $ git remote -v
    origin	https://xxx.xxx.xxx/xxx/xxx.git (fetch)
    origin	https://xxx.xxx.xxx/xxx/xxx.git (push)
    

    删除远程版本

    git push origin :test
    To https://xxx.xxx.net/xxx/xxx.git
     - [deleted]         test
    
    $ git branch -a
    * master
      remotes/origin/HEAD -> origin/master
      remotes/origin/master
    
    

    我是天王盖地虎的分割线

  • 相关阅读:
    剑指offer——斐波那契数列
    剑指offer——用两个栈实现队列
    剑指offer——二维数组中的查找
    LeetCode第九题—— Palindrome Number(判断回文数)
    java 面试题汇总
    idea设置方法注释
    解决java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
    Timer和TimerTask详解
    java8函数式接口(Functional Interface)
    Python执行选择性粘贴
  • 原文地址:https://www.cnblogs.com/yydcdut/p/4690864.html
Copyright © 2011-2022 走看看