Git简明教程

创建仓库

mkdir /path/to/your/project

cd /path/to/your/project
git init
git remote add origin https://xxxxx.git
创建你的第一个文件,提交,然后推送到仓库。
git config --global user.email "xx@xx.com"
git config --global user.name "xxx"
echo "bang li" >> contributors.txt
git add contributors.txt
git commit -m 'Initial commit with contributors'
git push -u origin master

常用操作

查询状态

git status

删除一个文件

git rm xxx

删除文件夹及其下所有的文件

git rm xxx -r -f

重命名

git mv fileA fileB

恢复文件的修改

git checkout --  ros_arduino_python/src/ros_arduino_python/arduino_driver.py

分支

查看分支

git branch

切换分支

git checkout test

创建分支

git  branch test1

上传分支

git push -u origin test1

下拉分支

git pull origin test1

忽略上传文件

在仓库的根目录下,新建.gitignore 文件,内用如下

*~
*pyc
*.swap
# Object files
*.o
*.ko
*.obj
*.elf

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值