• git


    git commit -m "first blood"

    创建初始版本库

    mkdir public_html

    cd public_html

    echo "my website is alive" > index.html

    git init   会创建一个.git目录

    git add index.html   添加到版本库里

    git status   显示中间状态的index.html

    git commit -m "first blood"  --author="alex <alex@alexhe.net>"

    查看提交

     git log

    commit 5dfaeabf1d53e98822f7fbd2fc348507f9d32b01

    Author: alexhe <alex@alexhe.net>

    Date:   Mon Aug 14 11:48:09 2017 +0800

     

        first blood

     

    commit 734634b2da33d371c9fb395fc3a39f7aaacebc1b

    Author: alexhjl <alex.he@zorpiahq.com>

    Date:   Thu Mar 16 21:20:59 2017 +0800

     

        alex 1st

    git show 5dfaeabf1d53e98822f7fbd2fc348507f9d32b01

    commit 5dfaeabf1d53e98822f7fbd2fc348507f9d32b01

    Author: alexhe <alex@alexhe.net>

    Date:   Mon Aug 14 11:48:09 2017 +0800

     

        first blood

     

    diff --git a/index.html b/index.html

    new file mode 100644

    index 0000000..8865c96

    --- /dev/null

    +++ b/index.html

    @@ -0,0 +1 @@

    +my website is alive

    git show-branch ,提供当前开发分支简介的单行摘要:

    git show-branch --more=10   参数--more=10表示额外10个版本。master这个名字是默认的分支名 

    [master] first blood

    [master^] alex 1st

    查看提交差异:

    git diff 83e6956f3dbcdb27b8aeac57ccc48d644a6e3744 5dfaeabf1d53e98822f7fbd2fc348507f9d32b01

    文件的删除和重命名

    git rm poem.html

    git commit -m "remove a poem"

    重命名:

    mv foo.html bar.html

    git rm foo.html

    git add bar.html

    或者git mv foo.html bar.html

    git commit -m "move foo to bar"

    创建版本库副本

    git clone public_html my_website

    git用户key已经别用的情况

    ssh-keygen

    Generating public/private rsa key pair.

    Enter file in which to save the key (/Users/alexhe/.ssh/id_rsa): /Users/alexhe/.ssh/id_rsa_personal

    Enter passphrase (empty for no passphrase): 

    Enter same passphrase again: 

    Your identification has been saved in /Users/alexhe/.ssh/id_rsa_personal.

    Your public key has been saved in /Users/alexhe/.ssh/id_rsa_personal.pub.

    The key fingerprint is:

    7f:3d:ae:82:ee:e5:cc:68:d0:9e:56:f3:32:5b:16:85 alexhe@alexmbp.local

     

     

    alexmbp:.ssh alexhe$ cat config 

    Host github-personal

    HostName github.com

    User git

    IdentityFile ~/.ssh/id_rsa_personal

     

     

    ssh -T git@github.com

    ssh -T git@github-personal

     

    git clone git@github.com:aaron111com/github_test.git

     

    git remote set-url origin github-personal:aaron111com/github_test.git

      581  vim index.html

      582  git add index.html 

      583  git commit -m "use personal key"

    git push

    查看谁提交的:

    git blame -L 35, init/version.c

    分支:

    git branch   列出分支名

    $ git branch

    * master

    git show-branch

    git branch -a

    * develop

      remotes/origin/HEAD -> origin/develop

      remotes/origin/develop

      remotes/origin/develop-exercise

      remotes/origin/develop-oauth-20170811

      remotes/origin/hotfix

      remotes/origin/master

      remotes/origin/release

      remotes/origin/release-20170722

      remotes/origin/spring-jta

     

     

     

    git branch remotes/origin/master

     

    alexmbp:xxx alexhe$ git branch

    * develop

      remotes/origin/master

     

    alexmbp:eht-y1da alexhe$ git checkout remotes/origin/master

    warning: refname 'remotes/origin/master' is ambiguous.

    Switched to branch 'remotes/origin/master'

     

    alexmbp:xxx alexhe$ git branch

      develop

    * remotes/origin/master

     

    git branch

      develop

    * remotes/origin/master

  • 相关阅读:
    logstash收集nginx日志写入kafka
    Logstash收集日志写入Redis
    Nginx反向代理kibana实现认证访问
    logstash收集nginx日志写入kafka1
    201999:渗透测试,基础学习,windows基础命令,笔记
    2019910:渗透测试,基础学习
    中华吸血鬼恶意病毒分析
    磁碟机病毒分析
    利用SQL语句对不同数据库进行高效果分页
    TimeBased Blind SQL Injection with Heavy Queries
  • 原文地址:https://www.cnblogs.com/alexhjl/p/7358893.html
Copyright © 2020-2023  润新知