Git基本操作(二)

写错了,我们可以撤回

如果我们添加上去了怎么办?一样可以撤回

万一我们提交了?那就按上一篇讲到的,撤回。。。。。。。

下面来看一下删除

 

接下来我们在git hub申请一个账号,创建一个远程的仓库

git clone https://github.com/ArronSmallWu/Test 

创建分支 git branch dev    切换分支git checkout dev

或者是创建和切换一起git checkout -b ak

创建分支并且在分支上进行创建文件和提交,最后回到master发现自己没有变化,那就对了

gec@ubuntu:~/Test$ ls
README.md
gec@ubuntu:~/Test$ git branch
* master
gec@ubuntu:~/Test$ git checkout -b shit
Switched to a new branch 'shit'
gec@ubuntu:~/Test$ git branch
  master
* shit
gec@ubuntu:~/Test$ echo "abc" > abc.txt
gec@ubuntu:~/Test$ ls
abc.txt  README.md
gec@ubuntu:~/Test$ cat abc.txt
abc
gec@ubuntu:~/Test$ git checkout  master 
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
gec@ubuntu:~/Test$ ls
abc.txt  README.md
gec@ubuntu:~/Test$ git checkout shit 
Switched to branch 'shit'
gec@ubuntu:~/Test$ git add abc.txt 
gec@ubuntu:~/Test$ git commit -m "abc"
[shit aa38121] abc
 1 file changed, 1 insertion(+)
 create mode 100644 abc.txt
gec@ubuntu:~/Test$ git checkout master 
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
gec@ubuntu:~/Test$ ls
README.md

好了,现在可以过河拆桥了,把shit分支合并了,然后删除这分支

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值