美文网首页
Git 笔记

Git 笔记

作者: 思考的虫子 | 来源:发表于2018-12-06 11:29 被阅读8次

    Git

    1. 安装

    添加SSH Key

    官方介绍

    Push an existing repository from the command line

    git remote add origin https://github.com/chunkai-meng/symfony.git
    git push -u origin master
    
    git config credential.helper store
    

    2. 使用

    Permanently ignore changes to a file

    If a file is already tracked by Git, adding that file to your .gitignore is not enough to ignore changes to the file. You also need to remove the information about the file from Git's index:

    These steps will not delete the file from your system. They just tell Git to ignore future updates to the file.

    Add the file in your .gitignore.

    Run the following:

    > git rm --cached <file>
    

    Commit the removal of the file and the updated .gitignore to your repo.

    3. 技法

    书写Commit Message的原则

    1. 首行是少于50字标题,首字母大写,末尾没有句号.
    2. ~/.vimrc 加入
    autocmd Filetype gitcommit setlocal spell textwidth=72
    
    1. TITLE:标题用命令式语气,表明采用了本次commit以后会发生什么(e.g. "Add auth to X")
    2. 留空一行写Body,用小于72个字符,描述what and why vs. how
    3. BODY:解释这次 commit 的目的(产生的影响,甚至副作用)。至于how(如何产生)不重要,代码已经解释了

    相关文章

      网友评论

          本文标题:Git 笔记

          本文链接:https://www.haomeiwen.com/subject/ihwncqtx.html