zoukankan      html  css  js  c++  java
  • GIT配置

    // 查看配置

    git config -l

    // 生成公钥

    ssh-keygen -t rsa -C “您的邮箱地址”

    // 配置用户名和邮箱

    git config --global user.name "pengdonglin"

    git config --global user.email "pengdonglin137@163.com"

     

    // 别名

    git config --global alias.st status 

    git config --global alias.co checkout

    git config --global alias.ci commit

    git config --global alias.br branch

    // 显示最后一次提交信息

    git config --global alias.last 'log -1'  

    // 换一种方式显示git log

    git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" 

     

    // 让Git显示颜色

    git config --global color.ui true

    // 提交时使用vim填写commit

    git config --global core.editor vim

    // 添加和提交远程分支

    git remote add origin git@code.csdn.net:pengdonglin137/u-boot.git

    git push -u origin master

    // 回退代码

    • 回退整套代码到最近一次提后的状态

    git reset --hard HEAD

    • 如果需要保留目前的修改

    git reset -- soft HEAD

    • 回退代码到指定的某次提交状态
    git reset --hard <本次提交的哈希码>  
    • 撤消已暂存的文件

    git reset HEAD <文件路径>

    • 撤消已修改的文件

    git checkout -- <文件路径>

    • 撤消未跟踪文件

    rm <文件或文件夹路径>

    • 清除所有未跟踪文件

    git clean -dxf   //清除所有未跟踪文件,包括纳入.gitignroe中的文件。如果要保留ignored的文件修改,使用参数-df

    • 配置diff

    这里我们使用difftool, 用meld:  git config --global diff.tool meld

    使用方法:git diff xx xx 或者直接使用 git diff

    • 配置merge

    这里我们使用mergetool, 仍然使用meld: git config --global merge.tool meld

    如果有多个文件比较,使用diffall : git config --global alias.diffall /PATH/TO/YOUR/git-diffall  (git-diffall 可以从http://files.cnblogs.com/pengdonglin137/git-diffall-master.zip 下载)

    使用方法:先执行git merge,然后执行git mergetool即可。

     

  • 相关阅读:
    挑战程序设计竞赛 dp
    算法导论 动态规划
    算法导论第二章
    divide conquer
    时间戳
    bootstrap 针对超小屏幕和中等屏幕设备定义的不同的类
    jQuery中的Ajax
    怎么判断一个变量是Null还是undefined
    认识Ajax
    关于apache
  • 原文地址:https://www.cnblogs.com/pengdonglin137/p/4638854.html
Copyright © 2011-2022 走看看