Git--简单入门操作

此内容适合小白借鉴参考:

➜ ~ git clone git@github.com:lifezq/goutils.git // 克隆远程仓库

正克隆到 'goutils'...

remote: Counting objects: 247, done.

remote: Total 247 (delta 0), reused 0 (delta 0), pack-reused 247

接收对象中: 100% (247/247), 36.53 KiB | 37.00 KiB/s, 完成.

处理 delta 中: 100% (118/118), 完成.

检查连接... 完成。

➜ ~ cd goutils

➜ goutils git:(master) ls

array.go array_test.go binary.go binary_test.go crypto disk.go disk_test.go encode hash LICENSE math rand README.md regexps struct_test.go sync

➜ goutils git:(master) git branch dev // git  ---创建新分支dev

➜ goutils git:(master) git checkout dev // git  -----检出新分支dev

切换到分支 'dev'

➜ goutils git:(dev) git status // git 状态查看位于分支 dev

nothing to commit, working tree clean

➜ goutils git:(dev) touch test.md // touch 出新的空文件

➜ goutils git:(dev) ✗ ls

array.go array_test.go binary.go binary_test.go crypto disk.go disk_test.go encode hash LICENSE math rand README.md regexps struct_test.go sync test.md

➜ goutils git:(dev) ✗ echo 'Hello world'> ./test.md // 向test.md文件输入Hello world内容

➜ goutils git:(dev) ✗ git status // 再次查看git状态

位于分支 dev

未跟踪的文件:

(使用 "git add <文件>..." 以包含要提交的内容)

test.md

提交为空,但是存在尚未跟踪的文件(使用 "git add" 建立跟踪)

➜ goutils git:(dev) ✗ git diff // git diff 不同版本比较差异

➜ goutils git:(dev) ✗ git add test.md // 将新文件test.md加入本地仓库索引

➜ goutils git:(dev) ✗ git status // 再次查看git状态

位于分支 dev

要提交的变更:

(使用 "git reset HEAD <文件>..." 以取消暂存)

新文件: test.md

➜ goutils git:(dev) ✗ git commit -m "test 测试提交" //将变动提交至本地仓库工作树

[dev 57dc8fe] test 测试提交

1 file changed, 1 insertion(+)

create mode 100644 test.md

➜ goutils git:(dev) git push origin dev // 推送新分支dev至远程代码仓库

➜ goutils git:(dev) git remote add yangyaqi git@github.com:lifezq/goutils.git // 创建新的远程数据元始源 yangyaqi 地址

➜ goutils git:(dev) git push yangyaqi dev // 将新分支dev通过源yangyaqi提交至远程dev分支

对象计数中: 3, 完成.

Delta compression using up to 4 threads.

压缩对象中: 100% (2/2), 完成.

写入对象中: 100% (3/3), 293 bytes | 0 bytes/s, 完成.

Total 3 (delta 1), reused 0 (delta 0)

remote: Resolving deltas: 100% (1/1), completed with 1 local object.

remote:

remote: Create a pull request for 'dev' on GitHub by visiting:

remote: https://github.com/lifezq/goutils/pull/new/dev

remote:

To github.com:lifezq/goutils.git

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值