码迷,mamicode.com
首页 > 其他好文 > 详细

Jenkins持续集成 之 git文件状态

时间:2018-12-01 23:43:10      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:dde   username   ack   this   tag   ESS   with   master   查询   

Jenkins持续集成 之 git文件状态

git 文件状态图

技术分享图片

git文件状态展示

kangdeMacBook-Air:cedarhd kang$ git status       #git文件状态查询
On branch master
Your branch is up to date with ‘origin/master‘.

nothing to commit, working tree clean

kangdeMacBook-Air:cedarhd kang$ touch test8.txt  #新建文件
kangdeMacBook-Air:cedarhd kang$ git status
On branch master
Your branch is up to date with ‘origin/master‘.

Untracked files:       #Untracked 新建文件状态
    (use "git add <file>..." to include in what will be committed)

    test8.txt

nothing added to commit but untracked files present (use "git add" to track)

kangdeMacBook-Air:cedarhd kang$ git add test8.txt  #提交到暂存区
kangdeMacBook-Air:cedarhd kang$ git status
On branch master
Your branch is up to date with ‘origin/master‘.

Changes to be committed:         #已经到了stage状态
    (use "git reset HEAD <file>..." to unstage)

    new file:   test8.txt

kangdeMacBook-Air:cedarhd kang$ git commit -m "test8.txt"  #提交到本地工作区
[master a6defd1] test8.txt
 Committer: kang <kang@kangdeMacBook-Air.local>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

        git config --global --edit

After doing this, you may fix the identity used for this commit with:

        git commit --amend --reset-author

 1 file changed, 0 insertions(+), 0 deletions(-) 
 create mode 100644 test8.txt
kangdeMacBook-Air:cedarhd kang$ git status        #unmodified 没有修改状态
On branch master
Your branch is ahead of ‘origin/master‘ by 1 commit.
    (use "git push" to publish your local commits)

nothing to commit, working tree clean

kangdeMacBook-Air:cedarhd kang$ git rm --cache test8.txt   #从缓存区删除test8.txt
rm ‘test8.txt‘
kangdeMacBook-Air:cedarhd kang$ git status
On branch master
Your branch is ahead of ‘origin/master‘ by 1 commit.
    (use "git push" to publish your local commits)

Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)

    deleted:    test8.txt

Untracked files:           #已返回Untracked文件
    (use "git add <file>..." to include in what will be committed)

    test8.txt

git checkout还原已删除的文件

kangdeMacBook-Air:cedarhd kang$ git add test8.txt    #提交到暂存区
kangdeMacBook-Air:cedarhd kang$ git commit -m "test8.txt"     #提交到工作 区
On branch master
Your branch is ahead of ‘origin/master‘ by 1 commit.
    (use "git push" to publish your local commits)

nothing to commit, working tree clean
kangdeMacBook-Air:cedarhd kang$ rm -f test8.txt      #删除本地文件
kangdeMacBook-Air:cedarhd kang$ ls -al
total 32
drwxr-xr-x  11 kang  staff  374 12  1 23:15 .
drwxr-xr-x   5 kang  staff  170 12  1 16:48 ..
drwxr-xr-x  16 kang  staff  544 12  1 23:15 .git
-rw-r--r--   1 kang  staff    3 12  1 16:18 test.txt
-rw-r--r--   1 kang  staff   23 12  1 16:18 test1.txt
-rw-r--r--   1 kang  staff    0 12  1 16:18 test2.txt
-rw-r--r--   1 kang  staff    6 12  1 16:18 test3.txt
-rw-r--r--   1 kang  staff   17 12  1 16:18 test4.txt
-rw-r--r--   1 kang  staff    0 12  1 16:21 test5.txt
-rw-r--r--   1 kang  staff    0 12  1 16:37 test6.txt
-rw-r--r--   1 kang  staff    0 12  1 22:43 test7.txt
kangdeMacBook-Air:cedarhd kang$ git checkout master test8.txt  #通过工作区还原文件
kangdeMacBook-Air:cedarhd kang$ ls -al
total 32
drwxr-xr-x  12 kang  staff  408 12  1 23:15 .
drwxr-xr-x   5 kang  staff  170 12  1 16:48 ..
drwxr-xr-x  16 kang  staff  544 12  1 23:15 .git
-rw-r--r--   1 kang  staff    3 12  1 16:18 test.txt
-rw-r--r--   1 kang  staff   23 12  1 16:18 test1.txt
-rw-r--r--   1 kang  staff    0 12  1 16:18 test2.txt
-rw-r--r--   1 kang  staff    6 12  1 16:18 test3.txt
-rw-r--r--   1 kang  staff   17 12  1 16:18 test4.txt
-rw-r--r--   1 kang  staff    0 12  1 16:21 test5.txt
-rw-r--r--   1 kang  staff    0 12  1 16:37 test6.txt
-rw-r--r--   1 kang  staff    0 12  1 22:43 test7.txt
-rw-r--r--   1 kang  staff    0 12  1 23:15 test8.txt

Jenkins持续集成 之 git文件状态

标签:dde   username   ack   this   tag   ESS   with   master   查询   

原文地址:http://blog.51cto.com/12965094/2324828

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!