• Git 常用命令


    git 操作:

      拉代码:git clone http|ssh代码克隆地址

      拉取分支:git clone -b 分支名 http|ssh代码克隆地址

      提交代码:

        ①git status(对比代码库与本地有什么区别)

        ②git add .(上传代码)

        ③git commit -m "新功能描述"(注释)

        ④git push 远程主机名 分支名(提交代码,不写主机名和分支名,默认提交至主干)

      常用命令:

        git branch -a  查看本地和远程主机的全部分支 

        vim .git/config 在项目根目录下修改远程仓库地址

        git remote -v 查看当前配置的远程仓库地址

        git checkout -b ccs-test origin/ccs-test  切换到ccs-test分支(默认是在master分支)

        git push -u origin develop  把代码推到远程主机的develop分支

        # git pull命令的作用是,取回远程主机某个分支的更新,再与本地的指定分支合并。

        git pull origin master:master #取回origin主机的master分支,与本地的master分支合并

    提交代码到代码库时报错:

    *** Please tell me who you are.
    
    Run
    
      git config --global user.email "you@example.com"
      git config --global user.name "Your Name"
    
    to set your account's default identity.
    Omit --global to set the identity only in this repository.
    
    fatal: unable to auto-detect email address (got 'min@min-PC.(none)')

    通过配置邮箱地址和用户名解决:

      git config --global user.email "you@example.com"
      git config --global user.name "Your Name"

    在windows系统提交代码或拉代码无需每次输入账号密码:

      在个人电脑上有时候懒得输入git的账号密码,可以使用此方法一劳永逸,不过这样账号同时也存在风险。 首先电脑上已经装了Git GUI 或者Git Bash,然后使用Win+R 键盘打开 运行 窗口,输入 %USERPROFILE% 回车。 这时候在该目录下有个.gitconfig的隐藏文件,使用文本编辑器打开,在底下添加如下两行:

    [credential]
    helper=store

      然后当下次输入账号密码后,Git会自动将信息保存在此目录的.git-credentials文件中,往后就不必重复输入了。

  • 相关阅读:
    matlab安装YaHei Consolas Hybrid字体
    Matlab各种拟合
    正态分布
    JQuery插件:遮罩+数据加载中。。。(特点:遮你想遮,罩你想罩)
    【调侃】IOC前世今生
    使用jquery的 uploadify,在谷歌浏览器上总会崩溃的解决方法
    源代码管理工具TFS2013安装与使用
    C# 给枚举定义DescriptionAttribute,把枚举转换为键值对
    Bootstrap 中文官网
    时间 时间戳 转换
  • 原文地址:https://www.cnblogs.com/cpw6/p/12066777.html
Copyright © 2020-2023  润新知