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

It's our first time to meet git

时间:2015-04-19 22:42:52      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:

Recently,we had learned how to make version control during the development of software system.

Among all those tools,git is one of the most powerful one.And our team learned how to use it in a 

short time by learning from a blog written by LiaoXuefeng.

1.Install git

Thanks to our team member LinChun,his MacPro can directly use git beacause he had installed XCode.

技术分享

2.Create a repository

            create a directory

技术分享

 

               init the repository and add a file to it

技术分享

use "git add" to add files to temporary storage area 

  "git commit" to add files to repository

 

                the readme.txt

技术分享

3."git status" and "git diff"

    "git status" is to see the current status of the repository,eg:

  技术分享

  "git diff" is to check the difference ,eg:

  技术分享

4.update the version of the file

   first,make changes to readme.txt

  技术分享

  add it,commit it,check it

技术分享

 repeat the process to get three different version of the text file,then we can

 use "git log" to see the logs of our versions

 技术分享

5.use command to roll back

 "git reset --hard Head(parameter to determine which version to roll back to)" eg:

技术分享

    after rolling back,we can check the log to verify

技术分享

   if we forget what we have done before,we can use "git reflog" to see the

   history of what we have done,eg:

技术分享

6.delete files in git

rm just delete your file from the working directory

技术分享

 

if you really want to delete the file from the repository,use "git rm"

技术分享

技术分享
or if you make a mistake,use "git checkout" will be fine
技术分享

It's our first time to meet git

标签:

原文地址:http://www.cnblogs.com/bwju/p/4440206.html

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