首页 > 其他 > 详细

git学习

时间:2019-03-23 19:20:01      阅读:187      评论:0      收藏:0      [点我收藏+]

参考自:《Python编程:从入门到实践》

1.首先输入用户名和邮箱,因为git是分布式

MINGW64 ~
$ git config --global user.name "XXX"

MINGW64 ~
$ git config --global user.email "XXX@qq.com"

 

 从github.com克隆一个仓储

$ git clone https://github.com/XXX/buleSea.git
Cloning into buleSea...
warning: You appear to have cloned an empty repository.

 

查看git的状态,一定要在有.git的目录里输入,否则是无效的

$ git status
On branch master

No commits yet

 

在仓储中新建一个py文件,再次查看状态: 

$ git status
On branch master

No commits yet

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

        git_practice.py

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

 

 将其添加到仓储中,但是还没有确认

F/myGit/buleSea (master)
$ git add .

F/myGit/buleSea (master)
$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   git_practice.py

 

进行commit,其中-m是当前commit的消息

$ git commit -m "Started project"
[master (root-commit) 0a1c5a1] Started project
 1 file changed, 1 insertion(+)
 create mode 100644 git_practice.py

 

使用git log查看仓储日志

$ git log
commit 0a1c5a1d624c25f2aa4127eaee384c6b9bf266ee (HEAD -> master)
Author: XXX<859377142@qq.com>
Date:   Sat Mar 23 09:15:07 2019 +0800

    Started project

 

使用这个命令查看简版日志

$ git log --pretty=oneline
0a1c5a1d624c25f2aa4127eaee384c6b9bf266ee (HEAD -> master) Started project
$ git checkout .
Updated 1 path from the index

 

将删除原来的commit。

git bash就是将本地对仓储的更改同步到github.com,并且.git记录了对项目的更改日志。

git学习

原文:https://www.cnblogs.com/BlueBlueSea/p/10585124.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!