git的一些操作记录

git

  • 协作的时候要把本地代码更新到最新的时候:

    1. 先查看远程分支列表,看是否有远程原始分支
    	$ git remote -v
    2. 如果没有远程原始分支
    	$ git remote add best https://github.com/...../.git  [best是自己起的名字,后面跟着远程仓库]
    3. 再次查看远程分支列表
        $ git remote -v
        会看到:
         best https://github.com/best/xyz.git (fetch)
         best https://github.com/best/xyz.git (push)
         
    4. fetch原始源分支的新版本到本地
        $ git fetch best
    5. 合并两个版本的代码
       	$ git merge best/master
    6. 把最新的代码提交到自己的github上
        $ git push -u best master   
    
  • 上传代码

    git add 文件名或目录
    git commit -m "描述"
    git push
    
  • config

    //增:
    //添加git config配置
    $ git config --global 命名 '值'
    
    //改:
    //如果这个命名存在也可以直接覆盖修改,还可以替换git config中已有的邮箱
    $ git config --global --replace-all user.email "输入你的邮箱"
    $ git config --global --replace-all user.name "输入你的用户名"
    
    //删:
    //删除命令
    $ git config --global --unset  命名
    
    //查:
    //查看所有config
    //$ git config --list
    $ git config --global --list
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值