plainchant
  • Welcome PCT‘s Blog
  • Golang
    • golang基础
      • Go 语言 select 的实现原理
      • golang数字最大值
      • go-defer
      • Channel实现
      • go逃逸分析
      • Golang调度
  • Linux
  • Linux开发
    • 查看磁盘的UUID并挂载
    • Linux内核开发示例
    • 误删Linux内核后修复系统
    • linux补丁的创建和应用
    • Git常用命令
    • SystemV消息队列使用范例
    • ubuntu搭建全局代理
    • linux安装和配置
  • 嵌入式
    • 计算机为什么存在补码
    • 一种可靠串口协议
    • CRC校验算法
    • RasperryPi3 Ros系统安装(Debian)
  • 套接字编程
    • TCP建立连接过程分析
    • 线程的分发
    • TCP的并发处理epoll
    • TCP的并发处理select
    • 非阻塞TCP示例
    • 阻塞TCP示例
    • UDP组播
    • UDP广播
    • 非阻塞UDP示例(fcntl方式)
    • 非阻塞UDP示例
    • 局域网发现协议
    • socket通信机制浅析-前言
  • 交友网站
  • 区块链
    • Wasm虚拟机
      • wagon外部参数和内部参数的统一
      • Wagon实现log函数的第二种方法
      • Wagon实现一个log函数
      • go版本wasm解析器分析
      • 解析wasm二进制文件
      • ONT实现API的流程
      • Wasm工具安装使用
    • BCH
      • SLP代币协议
    • Cosmos
      • 区块链共识进化史
      • Tendermint 的区块构成
      • CoinEx 链 Gas 费指南
      • CoinEx交易类型收集
      • Cosmos简介和环境搭建
    • ETH
      • Geth命令详解
    • BTC
      • 助记词到地址
  • 算法
    • 动态规划
  • HTTP
    • URL 在浏览器被被输入到页面展现的过程中发生了什么
  • 运维后台
    • Docker学习笔记
  • 数据型应用系统设计
    • 数据密集型应用系统设计读书笔记
    • 数据编码与演化
      • Kafka配置
      • protobuf简介
    • MySQL
      • mysql安装和数据目录变更
      • 深入理解事务
      • MySQL事务问题验证
    • Redis
      • Redis缓存实现
      • Redis基本概念
由 GitBook 提供支持
在本页
  • 1. 配置使用默认密码
  • 2. 使用vim作为默认的编辑器
  • 3. 基本使用命令
  • 3.1 查看本地版本的状态以及差异:
  • 3.2 增加到本地库:
  • 3.3 提交到本地:
  • 3.4 提交到远程仓库,即网络上:
  • 3.5 下载一个分支
  • 3.6 建立一个分支
  • 3.7 create a new repository on the command line
  • 4. 设置git配置

这有帮助吗?

  1. Linux开发

Git常用命令

[TOC]

1. 配置使用默认密码

cd ~



echo "https://eager7:pct1197639@github.com" > .git-credentials



git config --global credential.helper store
可以看到~/.gitconfig文件,会多了一项:



[credential]



    helper = store

2. 使用vim作为默认的编辑器

git config --global core.editor vim

3. 基本使用命令

3.1 查看本地版本的状态以及差异:

pct@ubuntu-x86:~/ubuntu-x86/IOTC$ git status



On branch master



Your branch is up-to-date with 'origin/master'.



Changes to be committed:



  (use "git reset HEAD <file>..." to unstage)



    new file: Makefile



    new file: main.c



    new file: utils.h

3.2 增加到本地库:

pct@ubuntu-x86:~/ubuntu-x86/IOTC$ git add .

3.3 提交到本地:

pct@ubuntu-x86:~/ubuntu-x86/IOTC$ git commit -a



[master 36cad9b] Add Makefile & main.c



 3 files changed, 153 insertions(+)



 create mode 100755 Makefile



 create mode 100644 main.c



 create mode 100755 utils.h

这样提交会弹出一个vim的文本编辑界面,写入你的注释,第一行简略描述,空一行,然后详细描述。

3.4 提交到远程仓库,即网络上:

pct@ubuntu-x86:~/ubuntu-x86/IOTC$ git push -u origin master 



Counting objects: 6, done.



Delta compression using up to 2 threads.



Compressing objects: 100% (5/5), done.



Writing objects: 100% (5/5), 1.79 KiB | 0 bytes/s, done.



Total 5 (delta 0), reused 0 (delta 0)



To https://github.com/eager7/IOTC



   6c85c21..36cad9b master -> master



Branch master set up to track remote branch master from origin.

3.5 下载一个分支

git clone https://github.com/eager7/socket_comm -b epoll

3.6 建立一个分支

在本地新建一个分支: git branch Branch1



切换到你的新分支: git checkout Branch1



将新分支发布在github上: git push origin Branch1



在本地删除一个分支: git branch -d Branch1



在github远程端删除一个分支: git push origin :Branch1 (分支名前的冒号代表删除)



更新本地分支:git pull origin Branch1

3.7 create a new repository on the command line

echo "# my_bashrc" >> README.md



git init



git add README.md



git commit -m "first commit"



git remote add origin https://github.com/eager7/my_bashrc.git



git push -u origin master

4. 设置git配置

设置git全局设置:

git config --global user.name "your_name" 



git config --global user.email "your_email"

需要取消git的全局设置:

git config --global --unset user.name 



git config --global --unset user.email

针对每个项目,单独设置用户名和邮箱,设置方法如下:

git config user.name "your_name" 



git config user.email "your_email"
上一页linux补丁的创建和应用下一页SystemV消息队列使用范例

最后更新于4年前

这有帮助吗?