• git记录


    1.  新建branch后,使用tortoisegit switch/checkout切换branch时,无法发现刚刚创建的最新的branch

           解决: 当前项目下右键,使用git fetch 重新拉取,或者命令行

    2.  git更改用户名密码后,无法弹出输入用户名密码的地方去输入, pull或者push提示:fatal: Authentication failed for 。。。。

         git config --system --unset credential.helper

         重新输入用户名密码ok

    3.  git每次都需要输入用户名密码: 经过1的操作后:

           随便进入一个git项目

          git config --global credential.helper store

           (全局解决,其它项目也生效,简单粗暴)

    4.  git stash    用于临时保存和回复修改,每次使用都会新加一个stash@{num},num是编号

                 场景: 当前正在修改,没改完,而版本库有更新,直接去pull会提示clean。。。error

                             此时需要先stash, 即暂时保存在stage区域(暂存区),然后pull更新版本就不会报错, 然后可以再将stash恢复出来继续修改。。。。。。

                更多可以查看: git stash --help, 如:

                      git stash pop      弹出最新的stash

                      git stash list       列出所有的stash

                      git stash show    显示stash的内容具体是什么,使用方法如 git stash show stash@{0}

                      git stash apply    恢复被暂存的文件,但是git栈中的这个不删除,用法:git stash apply stash@{0}

                      git stash drop     删除一个stash, 用法:git stash drop stash@{0}

                      git stash clear    清空

                          

    5.    使用git命令来切换branch

            有时候在win下面git拉取的code,再往linux下copy时编译会出问题,比如:软链接的so等,此时需要在linux拉

         git clone  https://xxx/project.git             拉master

         git branch -a                                         列出所有branch

                   git checkout -b  origin/feature/test      切换branch

        git branch                                               查看branch

        git pull origin feature/test                       拉取branch

      例如:  

      1. 查看可用的branch    

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

      2.   切换branch
         git checkout -b origin/feature/test
         Switched to a new branch 'origin/feature/test'

      3. 查看当前branch

        git branch
        master
        * origin/feature/test

      4. pull branch 代码

        git pull origin feature/test   //注意没有/, 是空格

        From https://xxx/xxxx
        * branch feature/test -> FETCH_HEAD
        Updating f288220..08c6c96

      

     6.  git clone 遇到"unable to access '……':Unable to communicate securely with peer: requested domain name does not match the server's certificate."问题

           git config --system http.sslverify false

      

        

         

  • 相关阅读:
    剑指offer(45)扑克牌顺子
    剑指offer(44)单词翻转序列
    剑指offer(43)左旋转字符串
    剑指offer(42)和为S的字符串
    剑指offer(41)和为S的连续正数序列
    剑指offer(40)数组中只出现一次的数字
    剑指offer(39)平衡二叉树
    面试金典——字符串压缩
    LeetCode——恢复二叉搜索树
    LeetCode——修剪二叉搜索树
  • 原文地址:https://www.cnblogs.com/leehm/p/11751263.html
Copyright © 2020-2023  润新知