Git学习笔记

Git学习

0X0:前言

git其实很早就有所接触,但是之前好的教程也少,没学明白,最后找了个图形化界面的先用着了,然后中间有一段时间也没怎么coding,所以也就没了动静,现在又重新拾起,开始coding,所以就从git开始吧!

1X0:全局配置

我觉得这是必要的。

设置commit的默认编辑器:修改 .git/config 中的core中添加editor=vim 或者使用全局设置命令 git config --global core.editor vim

设置提交的身份信息.

git config --global user.name jeb

git config --global user.email "xxx@xxx.com"

添加ssh公匙

ssh-keygen -t rsa -C "xxx@xxx.com"

1X1:基本操作

git init #初始化仓库

git add <filename> #将一个文件添加至strage

git add .

git commit -m "xxx" #将strage中的修改提交到HEAD中

git commit -am "xxx"

git status

git diff

git diff HEAD -- xxxx

git diff HEAD^

git log <--oneline/--decorate/--graph>

git reset HEAD -- xxxx #版本的恢复

git reset --hard HEAD^|commit_id

git rm -f xxx

git rm --cache xxx #将strage中最近的cache删除

git reflog

git branch <-D branch_name> <-d branch_name>

git checkout -- xxx

git checkout <-b branch_name>

git merge <--no-ff> <-m "xxx"> branch_name #合并分支

git stash <list|apply|<stash{0}>|drop|pop|> #暂存工作

git tag <-a tag_name> <-m tag_commit> <-d tag_name> #设置tag

git tag show tag_name commit_id

git remote add origin git@github:xxx.xxx #关联远程仓库

git push -u origin master #推送本地的master到远程

git push origin tag_name | --tags

git pull branch #同步远程仓库

use .gitignore to ignore some files #使用.gitignore编辑忽略文件的规则

git check-ignore -v xxx.xxx

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值