windows下使用git

来源:互联网 发布:行知教育集团 编辑:程序博客网 时间:2024/06/10 18:14

1、配置用户信息

配置个人的用户名称和电子邮件地址,这个实在你提交代码的时候做标记,谁提交的,邮箱是多少,方便沟通

$ git config --global user.name "ysp"$ git config --global user.email test@xxx.com

2、查看git配置

$ git config –list

core.symlinks=falsecore.autocrlf=truecore.fscache=truecolor.diff=autocolor.status=autocolor.branch=autocolor.interactive=truehelp.format=htmlhttp.sslcainfo=D:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crtdiff.astextplain.textconv=astextplainrebase.autosquash=truecredential.helper=manageruser.name=YangShuiPinguser.email=1037547965@qq.com

克隆仓库

比如,要克隆 Ruby 语言的 Git 代码仓库 Grit,可以用下面的命令:

$ git clone git://github.com/schacon/grit.git

执行该命令后,会在当前目录下创建一个名为grit的目录,其中包含一个 .git 的目录,用于保存下载下来的所有版本记录。
如果要自己定义要新建的项目目录名称,可以在上面的命令末尾指定新的名字:

$ git clone git://github.com/schacon/grit.git mygrit

查看本地状态,是否有文件做了修改还没提交:

git status 

$ git status
On branch master
Your branch is up-to-date with ‘origin/master’.
Changes not staged for commit:
(use “git add …” to update what will be committed)
(use “git checkout – …” to discard changes in working directory)
modified: app/Http/Controllers/Admin/CustomerController.php
modified: app/Http/Controllers/OrganizationController.php
no changes added to commit (use “git add” and/or “git commit -a”)

查看某个文件所做的修改:

git diff app/Http/Controllers/Admin/CustomerController.php

查看提交的日志修改记录:

git log

$ git log
commit 8151971e5403cf723b711dcd09ec48d4b4b3e8ec
Merge: 1914b56 ba9d268
Author: ysp <1037547965@qq.com>
Date: Tue Oct 17 15:33:54 2017 +0800

Merge branch 'master' of https://gitee.com/mybcc/BCCServiceV1.0.1完成学生老师列表

commit 1914b56e86710dc2ef0431c4cf37ba16e5d22973
Author: ysp <1037547965@qq.com>
Date: Tue Oct 17 15:33:33 2017 +0800

完成学生列表

查看某次修改的文件:

git show commit_id(就是git log commit 后面一长串随机字符)

10375@DESKTOP-4TDO7SL MINGW64 /d/phpStudy/WWW/BCCServiceV1.0.1 (master)
$ git show ba9d2683144f58c852a35ff2ba323a20490ddb54

查看本次本地代码与上一次的区别:

git diff ^HEAD

提交修改:

git add --all&& git commit -m'修复激活码换行问题'&&git pull&&git push
原创粉丝点击