windows下使用git

43 篇文章 6 订阅
1 篇文章 0 订阅

1、配置用户信息

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

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

2、查看git配置

$ git config --list

core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=D:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
credential.helper=manager
user.name=YangShuiPing
user.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

修改提交信息

git commit --amend

修改上一次的提交。
把文件加入上次提交,不修改commit.

git add some-file
git commit –amend –no-edit
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

SHUIPING_YANG

你的鼓励是我创作的最大动力。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值