git常用命令

那片星空,那片海 2019-02-11 22:02:25    18 阅读

克隆源相关命令

查看远程仓库地址

$ git remote -v
origin  https://github.com/apache/hive.git (fetch)
origin  https://github.com/apache/hive.git (push)

查看所有分支

$ git branch --all
  all
  help
* master
  remotes/origin/HEAD -> origin/master
  ......
  remotes/origin/branch-2
  remotes/origin/branch-2.0
  remotes/origin/branch-2.1
  ......

克隆指定分支

$ git clone -b branch-2 https://github.com/apache/hive.git
Cloning into 'hive'...
remote: Enumerating objects: 34, done.
remote: Counting objects: 100% (34/34), done.
remote: Compressing objects: 100% (25/25), done.
Receiving objects:  63% (344451/540849), 258.59 MiB | 358.00 KiB/s

查看本地分支

$ git branch
  all
  help
* master

master为当前工作分支

切换分支

$ git checkout -b v0.9rc1 origin/v0.9rc1
Branch v0.9rc1 set up to track remote branch v0.9rc1 from origin.
Switched to a new branch 'v0.9rc1'

#已经切换到v0.9rc1分支了
$ git branch
  master
* v0.9rc1

提交代码相关命令

设置全局用户命和邮箱

$ git config --global user.name "qingzhongli"
$ git config --global user.email "qingzhongli2018@gmail.com"

查看当前repo下的状态

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   _posts/2018-10-18-jvm-ygc-elapsed-time-and-frequency.md
        modified:   _posts/2018-10-20-shell-rsync-expect.md
        deleted:    about.md

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        .jekyll-metadata
        .sass-cache/
        _posts/2018-10-19-jvm-gc-g1-usage.md
        _posts/2018-10-23-design-pattern-singleton
        _posts/2018-11-01-jvm-memory-location.md
        _posts/2018-11-14-oracle-table-partition.md
        _posts/2018-11-15-Hadoop-Pseudo-Distributed-Operation.md
        _site/

no changes added to commit (use "git add" and/or "git commit -a")

追加新增文件

$ git add _posts/2018-11-15-Hadoop-Pseudo-Distributed-Operation.md

添加注释

$ git commit -m "Setup Hadoop Pseudo-Distributed Opertion"                                [master a8f9deb] Setup Hadoop Pseudo-Distributed Opertion
 1 file changed, 136 insertions(+)
 create mode 100644 _posts/2018-11-15-Hadoop-Pseudo-Distributed-Operation.md

提交

$ git push
To https://github.com/qingzhongli/qingzhongli.github.io.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/qingzhongli/qingzhongli.github.io.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

liqingzhong@liqingzhong00 MINGW64 /d/gitrepos/qingzhongli.github.io (master)
$ git pull
remote: Enumerating objects: 8, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 6 (delta 2), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (6/6), done.
From https://github.com/qingzhongli/qingzhongli.github.io
   d07a29e..b49d78a  master     -> origin/master
Merge made by the 'recursive' strategy.
 CNAME | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

liqingzhong@liqingzhong00 MINGW64 /d/gitrepos/qingzhongli.github.io (master)
$ git push
Enumerating objects: 10, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 1.83 KiB | 1.83 MiB/s, done.
Total 6 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To https://github.com/qingzhongli/qingzhongli.github.io.git
   b49d78a..defe70a  master -> master

liqingzhong@liqingzhong00 MINGW64 /d/gitrepos/qingzhongli.github.io (master)
$

对比本地与远端的差异

$ git diff  _posts/2018-10-18-jvm-ygc-elapsed-time-and-frequency.md
diff --git a/_posts/2018-10-18-jvm-ygc-elapsed-time-and-frequency.md b/_posts/2018-10-18-jvm-ygc-elapsed-time-and-frequency.md
index a98cf9b..f418a78 100644
--- a/_posts/2018-10-18-jvm-ygc-elapsed-time-and-frequency.md
+++ b/_posts/2018-10-18-jvm-ygc-elapsed-time-and-frequency.md
@@ -1,21 +1,24 @@
 ---
 layout: post
-title: jvm之判断ygc耗时和频率
+title: staticis ygc elapsed time and frequency
 ---

-首先明确所有分析的java应用的进程编号,然后在根据进程编号获取gc信息和运行时长,最后计算ygc的平均耗时和
+First find pid of java application , fetch gc information and elapsed time since the process was started, calculate ygc mean.

-**Step1、找出所查java应用的进程编号**
+**Step1、find pid of application**

:

本文由【刀锋】发布于开源中国,原文链接:https://my.oschina.net/qzhli/blog/2960564

全部评论: 0

    我有话说: